Skip to content

PowerShell

Add NSX-T Tags with PowerCLI

I don’t think the NSX-T PowerCLI module operates intuitively compared to most PowerShell modules I have worked with. It took me a while to figure out how to add NSX-T tags to a virtual machine with PowerCLI. I had to piece together Information from the documentation and various forums. I’ve put some notes here to help others (and remind myself in the future😊). Assuming you have done a Connect-VIServer  and a Connect-NsxtServer something like this should let you add tags to a VM easily. And that’s all there is to it to add NSX-T Tags with PowerCLI. Once you have an understanding of this basic functionality, it becomes much easier to do a mass add of multiple tags to multiple machines with a foreach. Also, note that $vmservice.addtags will only add the tags you specify. It should not impact any… Read More »Add NSX-T Tags with PowerCLI