AD scripts

Hi EE,

I looking for script to quarry  Active directory domain group SID IDs and  get the output in txt format. I am prepared to use CMD batch file or vbs .

Thank you in advance
Jey_PIT Security Eng Asked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Will SzymkowskiSenior Solution ArchitectCommented:
If you can use powershell it is very easy to accomplish this. Use the below command...
Import-module activedirectory
Get-ADGroup -Filter * | select Name, SID | out-file "c:\GroupSIDs.txt"

Open in new window


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Jey_PIT Security Eng Author Commented:
Thank you . We do have multiple domain in AD and We are on process to migrated  some of the groups in one domain to other , If this case how do I pull from sID History of migrated group using this script.
Will SzymkowskiSenior Solution ArchitectCommented:
Not a probelm, i have modified the script below, to add SIDHistory

Import-module activedirectory
Get-ADGroup -Filter * -Properties Name, SID, SIDHistory | select Name, SID, SIDHistory | out-file "c:\GroupSIDs.txt"

Open in new window

Jey_PIT Security Eng Author Commented:
I've requested that this question be closed as follows:

Accepted answer: 0 points for Jey_P's comment #a40713284
Assisted answer: 500 points for Will Szymkowski's comment #a40713023

for the following reason:

Thanks you.
Will SzymkowskiSenior Solution ArchitectCommented:
Why would this be an Assist, why not just award points to the solution and close the question rather than waiting for a moderator.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
VB Script

From novice to tech pro — start learning today.