Answered by:
Trying to pull the name of all ADgroups in our Domain

Question
-
Trying to pull all AD groups and their category in our OU. Do you know which switch to use the below is not working for me
get-adgroup -filter * -SearchBase "OU=OurDC,DC=ourDC,DC=local" | GroupType | Select Name | export-csv -notypeinformation C:\Users\test.csv
GroupType is not recognized. What should I use?
Wednesday, March 28, 2018 4:25 PM
Answers
-
Try:
Get-ADGroup -filter * -SearchBase "OU=,DC=,DC=local" | Select Name, GroupCategory, GroupScope | Export-Csv -NoTypeInformation C:\Users\Desktop\ADGroupt.csv
I meant to say no need to use -Properties, as GroupCategory and GroupScope are default properties, but they must be in the Select or they are not output.
Richard Mueller - MVP Enterprise Mobility (Identity and Access)
Wednesday, March 28, 2018 7:44 PM -
GroupType is an AD attribute, not a PowerShell property, so it is not retrieved by default. You can specify groupType with the -Properties parameter, but you get an integer that needs to be evaluated. Best to Select the properties GroupCategory and GroupScope. These are both default properties, so no need to use -Properties to retrieve them. Just list in the Select.
Richard Mueller - MVP Enterprise Mobility (Identity and Access)
- Edited by Richard MuellerMVP Wednesday, March 28, 2018 7:45 PM fixed typo
- Marked as answer by Todo123 Tuesday, April 24, 2018 6:58 PM
Wednesday, March 28, 2018 5:11 PM
All replies
-
Each element in a pipeline must be a CmdLet that can take pipeline input.
get-adgroup -filter * -SearchBase "OU=OurDC,DC=ourDC,DC=local" | Select Name, GroupType
\_(ツ)_/
Wednesday, March 28, 2018 4:59 PM -
GroupType is an AD attribute, not a PowerShell property, so it is not retrieved by default. You can specify groupType with the -Properties parameter, but you get an integer that needs to be evaluated. Best to Select the properties GroupCategory and GroupScope. These are both default properties, so no need to use -Properties to retrieve them. Just list in the Select.
Richard Mueller - MVP Enterprise Mobility (Identity and Access)
- Edited by Richard MuellerMVP Wednesday, March 28, 2018 7:45 PM fixed typo
- Marked as answer by Todo123 Tuesday, April 24, 2018 6:58 PM
Wednesday, March 28, 2018 5:11 PM -
Thanks Rich,
get-adgroup -filter * -Properties * -SearchBase "OU=,DC=,DC=local" | GroupType | Select Name | export-csv -notypeinformation C:\Users\Desktop\ADGroupt.csv
This pulled all group in the specified OU
but doesn't tell the group category. I need to get this right. Please help!
Wednesday, March 28, 2018 7:22 PM -
Try:
Get-ADGroup -filter * -SearchBase "OU=,DC=,DC=local" | Select Name, GroupCategory, GroupScope | Export-Csv -NoTypeInformation C:\Users\Desktop\ADGroupt.csv
I meant to say no need to use -Properties, as GroupCategory and GroupScope are default properties, but they must be in the Select or they are not output.
Richard Mueller - MVP Enterprise Mobility (Identity and Access)
Wednesday, March 28, 2018 7:44 PM -
Hello I am trying to pull all O365 Groups a user is member of
Get-DistributionGroup | where {(Get-DistributionGroupMember $_ | foreach {$_.PrimarySmtpAddress}) -contains "Myuseremailaddress" }
I received this error
"Cannot process argument transformation on parameter 'Identity'. Cannot convert"
Trying to pull this from Exchange Online
Can you please help?
Thursday, April 5, 2018 7:39 PM -
If you have a new question please open a new topic.
\_(ツ)_/
Thursday, April 5, 2018 7:46 PM