Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Thursday, July 5, 2018 9:10 AM
Hello,
I'm looking for a script which can export all Security Groups + their description in a CSV file.
I'm not an experienced powershell scripter.. can anyone help?
All replies (6)
Thursday, July 5, 2018 9:15 AM
Please carefully review the following links to set your expectation for posting in technical forums.
This Forum is for Scripting Questions Rather than script requests
- Script Gallery.
- Script Center
- Learn PowerShell
- Script requests
- PowerShell Documentation
- PowerShell Style Guidelines
- Posting guidelines
- Handy tips for posting to this forum
- How to ask questions in a technical forum
- Rubber duck problem solving
- How to write a bad forum post
- Help Vampires: A Spotter's Guide
- This forum is for scripting questions rather than script requests
\(ツ)_/
Thursday, July 5, 2018 9:16 AM
Hi,
we don't write scripts on demand, you should learn PowerShell before attempting anything.
You could start by researching the "Get-ADGroup" and the "Export-CSV" commandlets.
What have you tried so far and what errors are you getting?
Thursday, July 5, 2018 9:32 AM
currently I have this:
get-adgroup -filter * | sort name | select Name
It shows me the list of all security groups, I can also export them to csv, the only thing i'm not sure about is how to get the description added...
Thursday, July 5, 2018 9:35 AM
Please post code so that it is readable. Use the code posting tool on the edit bar.
For most AD CmdLets you need to specify the optional parameters that uou want returned.
Start with:
help get-adgroup -full
Carefully read the instructions on how to use the CmdLet.
\(ツ)_/
Thursday, July 5, 2018 9:56 AM
To get the description, when using the Get-ADGroup commandlet, use -Properties name,description:
Get-ADGroup -filter * -Properties description
Because the description isn't collected with the Get-ADGroup commandlet by default you need to specify to get it. Good luck with the rest, should be straight forward from now. Also you are getting all the groups and not just security groups...
Thursday, July 5, 2018 10:09 AM
Thanks for that.
Got it rolling now with following:
get-adgroup -filter {groupCategory -eq 'Security'} -Properties description | sort name | select name, description | Export-CSV -Path C:\Users\XXXX\groups.csv -NoTypeInformation