How to get a basic vSphere inventory view for a specified user using PowerShell - PowerCLI

Summary: A small script to check the visible vSphere basic inventory for a specified username leveraging PowerCLI. This is an alternative to logging in with the user into the vCenter UI and collecting data manually. ...

This article applies to This article does not apply to This article is not tied to any specific product. Not all product versions are identified in this article.

Instructions

Download the attached script on this KB article and extract the .zip package on a Mgmt system that has PowerCLI installed.

Note: The script can be further enhanced to print Datastores, Virtual Machines (VM) Names, and Network information or if wanted to export to a .csv format though this is out of the initial scope.


Script Parameter options:

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>

Example for reference on expected output:

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.

Example with the -detail option:

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.

Additional Information

Reference https://developer.broadcom.com/powercli/installation-guideThis hyperlink is taking you to a website outside of Dell Technologies. for guidance on how to install PowerCLI.

This is a simple script example to help customers and support people to run a common task, there is no official Dell technical support for scripting.

Affected Products

VMware ESXi 7.x, VMware ESXi 8.x
Article Properties
Article Number: 000196742
Article Type: How To
Last Modified: 13 May 2026
Version:  4
Find answers to your questions from other Dell users
Support Services
Check if your device is covered by Support Services.