How to export a list of Active Directory users

In this short tutorial we wil dive in to advanced stuff with active directory exports. We will be exporting Active Directory users Member of list. Or to what Groups the user belongs to. Also we will export the members of the Security group.

Member of

If you want to get a user’s group memberships, run this is PowerShell:

Get-ADPrincipalGroupMembership Username | Select Name | echo >> c:\groups.txt

Where Username is the name of the user you’re querying. Also the | echo >> c:\groups.txt will export this to a txt file. So remove it if you want it on screen.

 

Users who belong to a security group

If you want to get a user’s group memberships, run this is PowerShell:

Get-ADGroupMember Username | Select Name | echo >> c:\groups.txt

And again  Username is the name of the user you’re querying.

Links

You can find all the commands on the docs.microsoft.com/en-us/powershell/

Add a Comment

Your email address will not be published. Required fields are marked *