VMware Cloud Community
tdubb123
Expert
Expert
Jump to solution

get-content search VMs in 6 vcenters

I got a list o f vms in vms.txt

I need to search these VMs in all 6 vcenters and find out which vcenter they are at.

is there quick way to do this with this?

get-content c:\vms.txt | % {  get-vm $_ } | select Name

?

help please

thanks

1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-Content c:\vms.txt | %Get-VM $_ } | select Name,@{N='vCenter';E={$_.Uid.Split(“:”)[0].Split(“@”)[1]}}


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

View solution in original post

2 Replies
LucD
Leadership
Leadership
Jump to solution

Try like this

Get-Content c:\vms.txt | %Get-VM $_ } | select Name,@{N='vCenter';E={$_.Uid.Split(“:”)[0].Split(“@”)[1]}}


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

tdubb123
Expert
Expert
Jump to solution

Thanks Luc

0 Kudos