How can i get the list of VMs with or without having tags assigned to them

This post was originally published on this site

This is the command i have been trying but not giving vms without tags

 

Get-VM | Get-TagAssignment
   where {($_.Tag -eq $null) -or ($_.Tag -ne $null)} |
   Select @{N=’VM’;E={$_.Entity.Name}},`
   @{N=’TagName’;E={$_.Tag}},`
   @{N=”Cluster”;E={Get-Cluster -VM $_.Entity.Name}},`
   @{N=”ESX Host”;E={Get-VMHost -VM $_.Entity.Name}}

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.