ESX PowerCLI One-Liners
Jump to navigation
Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
Get ESX software version etc
Get ESX software version (inc build no)
get-vmhost -name MyESX* | %{(Get-View $_.ID).Config.Product}
Get VLANs
Get VLANs configured on ESX
Get-VMHost MyESX* | Get-VirtualPortGroup | Sort VLanId | Select VLanId, Name
Get Disk VML ID's
Get ESX disk VML ID's (SAN ID are a part of the VML - useful for identifying LUN's with SAN team). See ESX SAN LUN ID
Get-ScsiLun -VMHost MyESX* -LunType disk
Get SCSI paths
Get ESX SCSI paths info
Get-ScsiLun -VMHost MyESX* -LunType disk | Get-ScsiLunPath
Get Fibre Channel HBA info
Get ESX Fibre Channel HBA info
Get-VMHostHba -VMHost MyESX* | Where {$_.Type -eq "FibreChannel"} | Format-List *
Get HA Cluster Primaries
Display ESX hosts that are HA Primaries
Get-Cluster | Get-HAPrimaryVMHost | Select Name
Recent Storage Errors
Display recent ESX storage errors
Get-VIEvent -Entity (Get-VMHost MyESX*) -Type error | Where {$_.FullFormattedMessage -like "*storage*"} | Select CreatedTime, FullFormattedMessage
ESXi Logs
Generate diagnostic bundle
Get-Log -VMHost (Get-VMHost "MyESX*") -Bundle -DestinationPath C:\Users\name
VPXA
Get vpxa log
Get-Log vpxa -VMHost (Get-VMHost "MyESX*") | Select -ExpandProperty Entries
Messages
Get messages log
Get-Log messages -VMHost (Get-VMHost "MyESX*") | Select -ExpandProperty Entries
HostD
Get hostd log from line 1000
Get-Log hostd -VMHost (Get-VMHost "MyESX*") -StartLineNum 1000 -NumLines 100 | Select -ExpandProperty Entries
Filtered HostD
Get hostd log entries that include FindMe
Get-Log hostd -VMHost (Get-VMHost "MyESX*") | Select -Expand Entries | Select-String FindMe
Grid View
Dump hostd log into GridView
Get-Log hostd -VMHost (Get-VMHost "MyESX*") | Select -Expand Entries | Out-GridView