#1. This does not exclude local groups
Get-ADGroup -Filter * -properties members, isCriticalSystemObject | Select Name, isCriticalSystemObject | Where-Object { !($_.IsCriticalSystemObject)}
#2. This does a better job but there are some Sophos related groups I can’t filter out based on a property
Get-ADGroup -Filter ‘GroupCategory -eq “Security” -and GroupScope -eq “Global”’ -properties * | Where-Object { !($_.IsCriticalSystemObject)} | Select Name, isCriticalSystemObject | Sort Name
I’m trying to get a list of all security groups in Active Directory but to exclude system groups like DnsAdmins, DnsUpdateProxy
The objective is to export group names and locations in a CSV file so it can imported in to a different domain.
Before we proceed - when you post code or sample data or console output please format it as code using the preformatted text button ( </> ). Simply place your cursor on an empty line, click the button and paste your code.
Thanks in advance
You should go back and edit your other two posts to fix the formatting of your code. This way we can distinguish properly between code and not code.
I think you’re confused by the fact that you don’t see a $false for non critical system objects while you see a $true for critical system objects. You may run the following lines of code see what I meant.