Hello, please help. I need a command that, when I enter a VM name, tells me the host, cluster, and VCSA where the VM is instantiated.
I have tried:Get-VM vmname | Select Name, PowerState, @{N=‘VMHost’;E={$_.VMHost.Name}}
But it does not return a value for “VMHost.”
I appreciate your help.
it works for me. Do you work with multiple vcenters connections? If yes, disconnect from all and connect to just the one needed, as a test. To get also the VCSA try:
Hello,Works fine with :get-vm myvm | select Name, PowerState, @{N='VMHost';E={$_.VMHost}}
Hi, it works for me too, I haven't had any problems.
You can fetch data you need using this command:
Get-VM -Name "vmname" | Select-Object ` Name, @{N="Host";E={$_.VMHost.Name}}, @{N="Cluster";E={$_.VMHost.Parent.Name}}, @{N="vCenter";E={$global:DefaultVIServer.Name}}