Pages

Showing posts with label Questg Powershell. Show all posts
Showing posts with label Questg Powershell. Show all posts

Monday, April 20, 2015

List all users in domain with Membership to each AD Group.

To list all the users from a domain with whatever groups they are member of, Use the below script (Remember it needs Quest PowerShell for Active Directory installed on the server where it is being run from) :

get-qaduser * | foreach-object {
$User = $_
(get-QADuser $user).memberof | Get-Qadgroup | select @{n="UserSAMID";e={$User}},Name,SAMAccountname,DisplayName,Type,canonicalname
} | export-csv Users_Memberof.csv -notypeinformation


This will generate a CSV file which will have user's Samid in the first column and Group name (direct membership) in the second column with other group attributes in subsequent columns.

get-qaduser * | foreach-object {
$User = $_
(get-QADuser $user).allmemberof | Get-Qadgroup | select @{n="UserSAMID";e={$User}},Name,SAMAccountname,DisplayName,Type,canonicalname
} | export-csv Users_Memberof.csv -notypeinformation



This will generate a CSV file which will have user's Samid in the first column and Group name (indirect nested group membership) in the second column with other group attributes in subsequent columns.