I am creating customer tags for all of my guests. With attributes, I could just view the empty field under the VI Client. Here I am kind of lost. I can filter by vms with TAGs export that and remove those from a full list of guests but that is not very helpful.
I tried
$VMName = Get-VM NAME
if ($VMName.ExtensionData.Tag -ne $null) {Write-Host "yes"}
This works for a guest that has a tag. When I change -ne to -eq it does not report back what I thought would be a null value.
(Note, this really does not work at all. It sends back all guests, tagged or not.)
Can anyone shed some light on this?
Thank you. Matt
$vmlist = get-vm
$vmlist | where {(Get-TagAssignment $_).length -eq 0} | Sort-Object -Property name | ft name
This works! Using the length of the empty array rather than $null.
$vmlist = get-vm
$vmlist | where {(Get-TagAssignment $_).length -eq 0} | Sort-Object -Property name | ft name
This works! Using the length of the empty array rather than $null.