Powershell Get VM Datastore Location PowerCLI

The following one-liner uses PowerCLI to return the datastore(s) where your VMs are located:

Get-VM -Location "DATACENTERNAME" -Name "WILDCARDEDVMsNAME" | % { @{$_.Name=$_.DatastoreIDList | %{(Get-View -Property Name -Id $_).Name}} }

Leave a Reply