Flounder
asked on
Need a script to export group membership and user names from Active Directory
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Exactly what I needed. Thank you.
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
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