PowerCLI “Oneliners”

By | October 29, 2019

Get ESXi hosts versioning:

List VM’s and host details

The other day there were some issues with the storage system of our management environment at our secondary site and we had to do some onsite troubleshooting. As a precaution we turned off the running VM’s, before doing this we wanted to know where the VM’s resides on which ESXi node with some extra info that could be useful in a troubleshooting scenario.

To achieve this I used the following PowerCLI script:

This will give you an overview of the “running” VM’s on the corresponding ESXi node and could be useful if you want to locate your vCenter VM for instance.

To shutdown all VM’s in an automated fashion I used the following script:

If you want to exclude the vCenter from shutting down then use:

To view the results in a separate window add “Out-Gridview” to the script

List vlan-id’s

To prepare for an upcoming change to Upgrade one of our vCenters from version 6.0 (Windows based) to 6.7U2 I needed to collect some Datacenter object information. In this case it was a complete list of the vlan-id’s within this particular vCenter.

To achieve this you can use the following script:

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.