PowerCLI command to show CPU and memory ‘Hot Add’ status for VMs

I had an interesting request from a customer to list the CPU and memory ‘Hot Add’ status for their VMs. All of their VMs were in a single vCenter datacenter so we could query that object for the relevant info. After a bit of hacking I came up with the following PowerCLI one-liner:

get-datacenter DataCenterName | Get-VM | Get-View | Select Name, @{N="CpuHotAddEnabled";E={$_.Config.CpuHotAddEnabled}}, @{N="CpuHotRemoveEnabled";E={$_.Config.CpuHotRemoveEnabled}}, @{N="MemoryHotAddEnabled";E={$_.Config.MemoryHotAddEnabled}} | export-csv C:\HotAddVMs.csv

The command yielded the required information and was duly forwarded to the customer.

PowerCLI one liner to obtain RDM naa numbers from a vCenter datacenter

Launch PowerCLI and connect to a vCenter server:

Connect-VIServer vc01.vi.local

Then run the command below:

get-datacenter DataCenterName | Get-VM | Get-HardDisk -DiskType "RawPhysical","RawVirtual" | Select Parent,Name,CapacityKB,Filename,ScsiCanonicalName,DeviceName | export-csv C:\GetNAAs.csv

Open that csv file and the RDM naa numbers are there for your perusal.