VMware Cloud Community
souzader
Enthusiast
Enthusiast

remove specific tag from 500 vms

Hi Team,

I would like a help to remove a tag that is named "monitoring" from 500 vms with powercli.

Does anyone have some example? should I need to put the name of all the vms inside a csv?

 

Reply
0 Kudos
1 Reply
LucD
Leadership
Leadership

Placing the VM names is one option.
Assuming the CSV looks like this

Name
VM1
VM2

You could do

$tag = Get-Tag -Name 'monitoring'

ConvertFrom-Csv -InputObject $csv |
ForEach-Object -Process {
  Get-VM -Name $_.Name | Get-TagAssignment -Tag $tag |
  Remove-TagAssignment -Confirm:$false
}


 


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos