VMware Cloud Community

Powercli 6.0 release 1 get-vm -Id


I need a script that connects to multiple vCenters and searches for the existence of a VM to detail it's config. As we run SRM and therefore could find 2 instances of the VM, the original plus the SRM placeholder in the other vCenter, I need to be able to work out which is the original and only query that.

Hence I can't simply run get-vm -Name $VMName......I have to work out which is the original and then query get-vm -Id $Id_of_the_original, ie the one with no hard disks being the SRM placeholder

seemed to work fine, but have now upgraded to PowerCLi 6.0 release 1 and suddenly when querying the NumCPUs, for a 2 vCPU VM I now get an answer of "2 8", without the quotes

If I use get-vm -Name...it works correctly, just returning "2", without the quotes

as per above I can't really use -Name so am a little stuck

Anyone seen this behaviour? not sure what I am doing wrong?

0 Kudos
1 Reply

Which are the IDs you get back for the 2 VMs ?

Get-VM -Name $VMName | Select Name,Id

Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos