Solved

Active Directory Export Script

Posted on 2014-03-05
4
270 Views
Last Modified: 2014-10-17
Dear Experts,

Please could somebody help me devise a script that will export the following from Active Directory:

Domain; User; OU; Security Group;

and output to a CSV file.

I want to be able to run this on a number of different domains.

It'll be mainly on 2003 domains so I'm not sure we can use PowerShell.

Many thanks
0
Comment
Question by:andymellor
4 Comments
 
LVL 11

Assisted Solution

by:Giladn
Giladn earned 167 total points
ID: 39907472
0
 
LVL 2

Assisted Solution

by:allen_rich
allen_rich earned 166 total points
ID: 39908741
Check below script. It might be helpful for you.

$results = @()

$groups = Get-ADGroup -Filter * -SearchBase $OU

foreach ($group in $groups) {

$members = $group | Get-ADGroupMember

$results += New-Object psObject -Property @{'GroupName'=$group;'Members'=$members}

}

$results | Export-Csv 'GroupsAndMembers.csv' -NoTypeInformation


or


Get-ADGroup -Filter * -SearchBase $OU | select -ExpandProperty name | % {

$group= "$_"

$result += Get-ADGroupMember -identity "$_" | select @{n="Group";e={$group}},Name

}

$result | export-csv 'membership.csv' -notypeinformation
0
 
LVL 18

Accepted Solution

by:
Sarang Tinguria earned 167 total points
ID: 39911238
Chris has a great GUI tool for all theese stuffs

Cjwdev | AD Info - Active Directory Reporting www.cjwdev.co.uk/Software/ADReportingTool/Info.html
0
 

Author Comment

by:andymellor
ID: 40386712
Great Help!
0

Featured Post

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

Suggested Solutions

Last week, our Skyport webinar on “How to secure your Active Directory” (https://www.experts-exchange.com/videos/5810/Webinar-Is-Your-Active-Directory-as-Secure-as-You-Think.html?cid=Gene_Skyport) provided 218 attendees with a step-by-step guide for…
This article describes my battle tested process for setting up delegation. I use this process anywhere that I need to setup delegation. In the article I will show how it applies to Active Directory
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

828 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