SOLVED

How can I list only groups with a gidNumber?

Brass Contributor

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

 

 

1 Reply
best response confirmed by Baron164 (Brass Contributor)
Solution

@Baron164 

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 -NoTypeInformation

 

Read more about filters over here

https://www.easy365manager.com/get-adgroup-filter-example/ 

1 best response

Accepted Solutions
best response confirmed by Baron164 (Brass Contributor)
Solution

@Baron164 

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 -NoTypeInformation

 

Read more about filters over here

https://www.easy365manager.com/get-adgroup-filter-example/ 

View solution in original post