DefinIT Because if IT were easy, everyone would do it…

vSphere PowerCLI One-liners

PowerCLI Logo

Get the time on all ESXi hosts (Compatable with PowerCLI 4.1 up):

get-vmhost | select Name,@{Name="Time";Expression={(get-view $_.ExtensionData.configManager.DateTimeSystem).QueryDateTime()}}

Set the time on all ESXi hosts to the PowerCLI host's time (Compatable with PowerCLI 4.1 up):

get-vmhost | %{(get-view $_.ExtensionData.configManager.DateTimeSystem).UpdateDateTime((Get-Date -format u)) }

List all RDM disks (use the -Location paramater to narrow it down):

Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent,Name,DiskType,ScsiCanonicalName,DeviceName

List the vMotion IP Addresses of all hosts:

Get-VMHost | %{ $VMHost=$_.Name;(get-view $} | select @{name="Host"; expression={$VMHost}}, ipaddress, subnetmask

Creative Commons License
vSphere PowerCLI One-liners by DefinIT, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License.

Comments (0) Trackbacks (0)

No comments yet.

Leave a comment

No trackbacks yet.