VMware Cloud Community
zsoltesz
Enthusiast
Enthusiast

Get the list of virtual machines from the 'root' folder

I tried to use Get-VM to list the virtual machines from the datacenter 'root' folder (virtual machines directly under the Datacenter), but I was unsuccessful. The Get-VM -Location (Get-Folder vm -Location Datacenter_name) is not working. Could anyone show me the right syntax?

0 Kudos
1 Reply
zsoltesz
Enthusiast
Enthusiast

I used the -noRecursion option in a bad way. The script below is working well.

get-vm -Location (get-folder vm -Location VCE) -NoRecursion

0 Kudos