Solved

Active Directory Export Script

Posted on 2010-09-14
7
354 Views
Last Modified: 2012-05-10
I need to export the name of each OU, Security Group and Distribution Groups along with their members names to a text file.  Our domain name is FSS.local and our DC is FSSFS.  Does anyone have a clue how to do this?
0
Comment
Question by:steveLaMi
7 Comments
 
LVL 6

Expert Comment

by:ajb2222
ID: 33673789
at the command line

net users /domain
will get you a list of users

net groups /domain
will get you a list of groups

you can direct them into a text file like this
net users /domain>USERS.TEXT
net groups /domain>>USERS.TEXT
0
 

Expert Comment

by:matthewmiller
ID: 33673978
For security group membership, create a batch file that reads:
cscript listgroup.vbs>grouplist.txt

Create a vbs file named "listgroup.vbs" containing:

On Error Resume Next
Set objGroup = GetObject _
  ("LDAP://cn=<groupname>;ou=<path to group>;dc=FSS,dc=local")
objGroup.GetInfo
arrMemberOf = objGroup.GetEx("member")
WScript.Echo "<groupname>"
For Each strMember in arrMemberOf
  WScript.echo strMember
Next

This will create a file named whatever you put in place of <groupname>. You'd have to do this with each security group or distribution list.
0
 

Author Comment

by:steveLaMi
ID: 33673995
Is there a way to get the users of a distribution group into a text file?
0
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
LVL 57

Expert Comment

by:Mike Kline
ID: 33673996
I would suggest something like adfind or powershell.  Michael Smith has a good overview of doing this with adfind
http://theessentialexchange.com/blogs/michael/archive/2007/11/13/listing-members-of-distribution-lists-and-security-groups.aspx
In addition to that if you want to export the OUs and their names
adfind -default -f objectcategory=organizationalunit name
Thanks
Mike
0
 

Author Comment

by:steveLaMi
ID: 33674005
Matt... I didnt see your answer before I posted my last comment, I will give it a try
0
 
LVL 17

Accepted Solution

by:
Tony Massa earned 500 total points
ID: 33674190
Here's a script that will prompt for the DNS domain name, and group name, then put the user info into an Excel spreadsheet.  Note:  Assumes you have Excel installed on the computer you're running it on.
Group-Members-to-Excel.vbs.txt
0
 
LVL 5

Expert Comment

by:rajans
ID: 33675267
Here is another script which you can use to get all groups and group member details:

http://gallery.technet.microsoft.com/ScriptCenter/en-us/dcc9432e-d541-4be2-a39c-637c8d4c9fd0
0

Featured Post

Does Powershell have you tied up in knots?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Programmatically signing Word macros 4 61
Power shell script 6 55
AD LDAP LDS 3 47
Changing settings for Outlook from NTLM to Negotiate. Are there any pitfalls? 2 45
This is pretty cool.  The purpose of this VB Script is to help you document where JAR (Java ARchive) files and specifically java class files are located so that you can address issues seen with a client or that you can speak intelligently with a dev…
Mapping Drives using Group policy preferences Are you still using old scripts to map your network drives if so this article will show you how to get away for old scripts and move toward Group Policy Preference for mapping them. First things f…
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through the process of configuring their Windows Server 2012 domain controller to synchronize its time with a trusted, external resource. Use Google, Bing, or other preferred search engine to locate trusted NTP …

947 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now