Solved

Need a script to export group membership and user names from Active Directory

Posted on 2014-12-16
4
20 Views
Last Modified: 2016-06-16
I have a request to pull a list from Active Directory of First and Last names from a list of usernames and list users in a list of AD groups.

Does anyone have a script for the following?
1. Based on a list of usernames in a text file, Query First and Last names to a .csv
2. Export group membership to a .csv
Thanks.
0
Comment
Question by:Flounder
4 Comments
 
LVL 35

Expert Comment

by:Mahesh
ID: 40504753
For Groups, you can use within Powershell AD Module

PowerShell
Import-Module activedirectory
Get-ADGroupMember -Identity <GroupName> | Select Name, sAMAccountName | Export-csv <Csv file path>

You can create excel file with concatenate function for all groups and add output of this excel file in .ps1 file

Example
Powershell
import-module activedirectory
Get-ADGroupMember -Identity Group1 | Select Name, SamAccountName | Export-csv C:\group1.csv
Get-ADGroupMember -Identity Group2 | Select Name, SamAccountName | Export-csv C:\group2.csv

Open in new window


For list of users you can use Bulk AD users from WiseSoft, a free tool which can give you output based on list
0
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
ID: 40506309
Hi Flounder, there's an old script here that I just dug up, that might give you what you need as well:
http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_23974628.html

Regards,

Rob.
1
 

Author Comment

by:Flounder
ID: 40508299
Exactly what I needed.  Thank you.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

A Bare Metal Image backup allows for the restore of an entire system to a similar or dissimilar hardware. They are highly useful for migrations and disaster recovery. Bare Metal Image backups support Full and Incremental backups. Differential backup…
In this article, we will see the basic design consideration while designing a Multi-tenant web application in a simple manner. Though, many frameworks are available in the market to develop a multi - tenant application, but do they provide data, cod…
This video Micro Tutorial explains how to clone a hard drive using a commercial software product for Windows systems called Casper from Future Systems Solutions (FSS). Cloning makes an exact, complete copy of one hard disk drive (HDD) onto another d…
Windows 8 comes with a dramatically different user interface known as Metro. Notably missing from the new interface is a Start button and Start Menu. Many users do not like it, much preferring the interface of earlier versions — Windows 7, Windows X…

758 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