VMware Cloud Community
ESNJR
Contributor
Contributor

remove vm tag from multiple vms

Hi All, I'm using vsphere 6.7 and need to remove certain tag from multiple VM's and I don't see a way of doing this in the HTML5 client.  I also tried using this powercli cmdlet Get-Tag -Category <tag> | Remove-Tag without success.   Any guidance out there is appreciated.

 

Thanks 

Labels (1)
0 Kudos
3 Replies
hirschinho
Contributor
Contributor

Hi, 
have you tried this way ?

$VMs=get-content C:\Temp\test.txt

$Tag = Get-TagAssignment -Tag "New Tag"

foreach ($VM in $VMs){
$VMName = Get-VM -name $vm
Remove-TagAssignment $Tag -Confirm:$false
}

0 Kudos
Kuldeep2106
Contributor
Contributor

The right script is mentioned below

$VMs=get-content C:\Temp\test.txt

$Tag = Get-TagAssignment -Category "Category Name"

foreach ($VM in $VMs){
$VMName = Get-VM -name $vm
Remove-TagAssignment $Tag -Confirm:$false
}

0 Kudos
Kuldeep2106
Contributor
Contributor

Please try Below:

The right script is mentioned below

$VMs=get-content C:\Temp\test.txt

$Tag = Get-TagAssignment -Category "Category Name"

foreach ($VM in $VMs){
$VMName = Get-VM -name $vm
Remove-TagAssignment $Tag -Confirm:$false
}

0 Kudos