PowerShellを使用して指定したユーザーの基本的なvSphereインベントリー ビューを取得する方法 - PowerCLI

概要: PowerCLIを使用して、指定されたユーザー名に対して表示されているvSphere基本インベントリーを確認するための小さなスクリプト。 これは、ユーザーとしてvCenter UIにログインし、手動でデータを収集する代わりに使用できます。

この記事は次に適用されます: この記事は次には適用されません: この記事は、特定の製品に関連付けられていません。 すべての製品パージョンがこの記事に記載されているわけではありません。

手順

このKB記事に添付されているスクリプトをダウンロードし、PowerCLIがインストールされている管理システムに.zipパッケージを抽出します。

注:スクリプトをさらに拡張して、データストア、仮想マシン(VM)名、ネットワーク情報を出力したり、.csv形式にエクスポートしたりする場合がありますが、これは初期範囲外です。


スクリプト パラメーターのオプション:

PS C:\inventory> .\GetUserInventory.ps1 -vcenter dvcsa-w1.dubai.ad -vcuser administrator@vsphere.local -vcpassword "xxxxx”

[Mandatory] -vcenter <ip or fqdn of the targeted vCenter>
[Mandatory] -vcuser <username to test/list inventory of the targeted vCenter>

[Optional] -vcpassword <password of the -vcuser, if not used the script will prompt interactively for password>
[Optional] -detail <if used the script will print Datacenters, Clusters and hosts names>

期待される出力の参照例:

PS C:\inventory> .\GetUserInventory.ps1 -vcenter dvcsa-w1.dubai.ad -vcuser administrator@vsphere.local -vcpassword "xxxxx”

     ∞ Connecting to provided vcenter dvcsa-w1.dubai.ad
     ∞ 
     √ Connected to:
     √ 
     √ VCName            VCVersion
     √ ------            ---------
     √ dvcsa-w1.dubai.ad 6.7.0    
     √ 
     √ 
     ∞ 
     ∞ Inventory Listing
     ∞ 
     √    + dvcsa-w1.dubai.ad :
     √ 
     √ DataCenters Clusters Hosts VM DataStores VDS PortGroups
     √ ----------- -------- ----- -- ---------- --- ----------
     √           2        5    15  6          9   5         10
     √ 
     √ 
     ∞
     √ All done.

detailオプションを使用した例:

PS C:\inventory> .\GetUserInventory.ps1 -vcenter dvcsa-w1.dubai.ad -vcuser administrator@vsphere.local -vcpassword “xxxxx” -detail

     ∞ Connecting to provided vcenter dvcsa-w1.dubai.ad
     ∞ 
     √ Connected to:
     √ 
     √ VCName            VCVersion
     √ ------            ---------
     √ dvcsa-w1.dubai.ad 6.7.0    
     √ 
     √ 
     ∞ 
     ∞ Inventory Listing
     ∞ 
     √    + dvcsa-w1.dubai.ad :
     √ 
     √ DataCenters Clusters Hosts VM DataStores VDS PortGroups
     √ ----------- -------- ----- -- ---------- --- ----------
     √           2        5    15  6          9   5         10
     √ 
     √ 
     ∞
     ∞       - W1-Datacenter
     ∞
     ∞          - Cluster-A
     ∞             - w1-cla-n01.dubai.ad
     ∞             - w1-cla-n02.dubai.ad
     ∞             - w1-cla-n03.dubai.ad
     ∞
     ∞          - Cluster-B
     ∞             - w1-clb-n01.dubai.ad
     ∞             - w1-clb-n02.dubai.ad
     ∞             - w1-clb-n03.dubai.ad
     ∞
     ∞          - Cluster-C
     ∞             - w1-clc-n01.dubai.ad
     ∞             - w1-clc-n02.dubai.ad
     ∞             - w1-clc-n03.dubai.ad
     ∞
     ∞       - W2-Datacenter
     ∞
     ∞          - Cluster-D
     ∞             - w1-cld-n01.dubai.ad
     ∞             - w1-cld-n02.dubai.ad
     ∞             - w1-cld-n03.dubai.ad
     ∞
     ∞          - Cluster-E
     ∞             - w1-cle-n01.dubai.ad
     ∞             - w1-cle-n02.dubai.ad
     ∞             - w1-cle-n03.dubai.ad
     ∞
     √ All done.

その他の情報

PowerCLIのインストール方法については、https://developer.broadcom.com/powercli/installation-guideこのハイパーリンクをクリックすると、デル・テクノロジーズ以外のWebサイトにアクセスします。を参照してください

これは、お客様とサポート担当者が共通のタスクを実行するのに役立つ簡単なスクリプトの例です。スクリプトに関する公式のDellテクニカル サポートはありません。

対象製品

VMware ESXi 7.x, VMware ESXi 8.x
文書のプロパティ
文書番号: 000196742
文書の種類: How To
最終更新: 13 5月 2026
バージョン:  4
質問に対する他のDellユーザーからの回答を見つける
サポート サービス
お使いのデバイスがサポート サービスの対象かどうかを確認してください。