VMware Cloud Community
tdubb123
Expert
Expert

get-view -viewtype virtualmachine -filter

I got a list of vms

vms.txt

how do I use get-view with the list of vms in the txt file?

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

You could do something like this.

$names = (Get-Content -Path .\vmnames.txt ) -join '|'

Get-View -ViewType VirtualMachine -Filter @{Name=$names}


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

Reply
0 Kudos