Automation

 View Only
Expand all | Collapse all

get-content search VMs in 6 vcenters

  • 1.  get-content search VMs in 6 vcenters

    Posted Nov 03, 2016 09:18 PM

    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



  • 2.  RE: get-content search VMs in 6 vcenters
    Best Answer

    Posted Nov 04, 2016 06:48 AM

    Try like this

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



  • 3.  RE: get-content search VMs in 6 vcenters

    Posted Nov 07, 2016 07:31 PM

    Thanks Luc