PowerCLI Snippets

Some PowerCLI one-liners that are pretty useful

List the vSphere ESXi build version on all hosts

get-view -ViewType HostSystem -Property Name, Config.Product | select Name,{$_.Config.Product.FullName},{$_.Config.Product.Build} | ft -auto

List the VM name and IP address

Get-VM | Select Name, @{N="IP Address";E={@($_.guest.IPAddress[0])}}

Get the HBA WWPNs of all hosts

Get-VMhost | Get-VMHostHBA -Type FibreChannel | Select VMHost,Device,@{N="WWN";E={"{0:X}" -f $_.PortWorldWideName}}  | Sort VMhost,Device

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s