PowerCLI

 View Only

 PowerCLI command

Miguel Munoz's profile image
Miguel Munoz posted Mar 10, 2026 11:17 PM

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.

JStars's profile image
JStars

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:

Get-VM vmname | Select Name, PowerState, @{N='VMHost';E={$_.VMHost.Name}}, @{N='VCSA';E={$_.Uid.Split('@')[1].Split(':')[0]}}