Hi,
I have a script to assign a tag in a category to vms from a csv
it works well with powercli 6.5
but I have to replace the tag when the tag exists
or a powercli script to erase the tag with the category Application_Patch
the powercli scrip is :
Connect-viserver vcenter1 -user vcenteruser -pass vcenterpassword
$pathDev ="C:\Scripts\Tags_patch\ressources\"
set-location $pathDev
$CMDBInfo = Import-CSV C:\Scripts\Tags_patch\ressources\cmdbinfo.csv
ForEach ($item in $CMDBInfo)
{
$Name = $item.Name
$Tag = $item.Application_Patch
#Write-host "Nom SRV : " $name " Categorie" $tag
Write-Host ".... Assigning $Tag in Category Application_Patch to $Name "
Get-VM $Name | New-TagAssignment -Tag $Tag
the csv file is like this :
"Name","Application_Patch"
"srv1","5_Autres"
"srv2","4_Nuit"
Thank you for your help