I am using ADFIND to query Active Directory in my environment.
Using a Power Shell script to read all of the groups in my environment, I would like to work with groups that do not meet the requirements.
For example, if Group Names are not a specific length, I would like extract their owner.
Another query, would be to work with groups that may have spaces in their name. This should be done using regular expressions, but for some reason – it doesn't.
To my knowledge, you can't do any sort of regex filtering in the AD query itself. Even when you're using the -Filter parameter on the PowerShell AD cmdlets, those get translated into LDAP search syntax, which has no such functionality. You can search for all groups, and then do the regex filtering locally with any PowerShell code you want, but that will be slower.
The topic ‘filter AD Groups with regular expression’ is closed to new replies.