Finding NSX Security Groups Backed by Active Directory Groups

Just a quick post on PowerNSX, I was working with a customer who had a large number of security groups configured within their NSX environment. For troubleshooting purposes they needed to remove security groups that were backed by Active Directory groups but there wasn’t an easy way to tell from the UI which groups these were (and they didn’t remmeber the names at this point)
Fortunately, a 1 line command in PowerNSX did the heavy lifting for us.
# This will return the list of NSX Security Groups that are backed by Active Directory Groups for you to review

Get-NsxSecurityGroup | Where {$_.InnerXml -like "*DirectoryGroup*"}

# Alternatively, to also remove the security groups as part of the command

# Note: you will be prompted to confirm the group(s) it finds

Get-NsxSecurityGroup | Where {$_.InnerXml -like "*DirectoryGroup*"} | Remove-NsxSecurityGroup
https://gist.github.com/mtellin/6a782c02fa04d3b30288fff48ecc0339

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Site Footer