From 0581d89cbe79ccca9968761e9a70ad11cc513113 Mon Sep 17 00:00:00 2001 From: Doug Taliaferro Date: Wed, 3 Oct 2018 21:16:50 -0400 Subject: [PATCH] Sample script to set VM tags in the guestinfo --- Scripts/Set-TagsInGuestinfo.ps1 | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Scripts/Set-TagsInGuestinfo.ps1 b/Scripts/Set-TagsInGuestinfo.ps1 index e895759..c245c05 100644 --- a/Scripts/Set-TagsInGuestinfo.ps1 +++ b/Scripts/Set-TagsInGuestinfo.ps1 @@ -79,16 +79,16 @@ ForEach ($categoryName in $Categories) { # Get Tag assignments for the VMs $tags = Get-TagAssignment -Entity $VMs -Category $category - - # Group the tags by VM (in this case the Entity property of Group-Object) + + # Group the tags by VM (in this case the Entity property of Group-Object) $groups = $tags | Group-Object -Property Entity - - # Get each VM and set the guestinfo + + # Get each VM and set the guestinfo ForEach ($item in $groups) { $vm = get-vm $item.Name - # Multiple tags of the same category are joined + # Multiple tags of the same category are joined $guestinfoValue = $item.Group.Tag.Name -join $Delimiter - + Write-Host "$($vm): setting '$guestinfoName' = '$guestinfoValue'" New-AdvancedSetting -Entity $vm -Name $guestinfoName -Value $guestinfoValue -Confirm:$false -Force | Out-Null }