- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes I have tried it just now and it works as you mentioned, gives me a list of the VM's that match all the specified tags and I have populated it from the list of available tags on the cluster.
I also added a limit on the Get-VM's to put it into a limited location so I dont search an entire vcenter just a specific datacenter
$location = Get-Datacenter | Out-GridView -Title "Select single location to run checks on" -OutputMode Single
$vms = Get-VM -Location $location -Tag $tagNames
$tagNames | ForEach-Object -Process {
$vms = Get-VM -Location $location -Tag $_ | where{$vms.Name -contains $_.Name}
}
$vms.Name | Sort-Object |Format-Table -Autosize