Forum Discussion
Baron164
Jul 13, 2022Brass Contributor
How can I list only groups with a gidNumber?
I need to export a list of ad groups and their gidNumber. This is what I have so far. My issue is that this also gives me groups without gidNumbers and I don't want those. How can I filter out groups that don't have a gidNumber?
Get-ADGroup -Filter "*" -Property gidNUmber | select Name, gidNumber | Sort-Object -Property gidNumber | export-csv -Path C:\Labs\exportgroups.csv -NoTypeInformation
Hi
You can update the filter to be as the following
Get-ADGroup -Filter "gidNUmber -ge 0" -Property gidNUmber | select Name, gidNumber | Sort-Object -Property gidNumber | export-csv -Path C:\Labs\exportgroups.csv -NoTypeInformationRead more about filters over here
1 Reply
- farismalaebIron Contributor
Hi
You can update the filter to be as the following
Get-ADGroup -Filter "gidNUmber -ge 0" -Property gidNUmber | select Name, gidNumber | Sort-Object -Property gidNumber | export-csv -Path C:\Labs\exportgroups.csv -NoTypeInformationRead more about filters over here