Active Directory – PowerShell – Return User, Username, Email Address

email me

This is how you would return the SAM account name, username, and email address for a specific domain. Useful, especially if you need to return data from multiple domains (just change the DCSERVER and OU, accordingly).

Get-AdGroupMember -server "DCSERVER.DOMAIN.com" -identity "OU-NAME" | Get-ADUser -properties Displayname, SamAccountName, EmailAddress | Select-Object Displayname, SamAccountName, EmailAddress | Export-CSV c:\reports\DOMAIN.csv

 

Notes

Get-AdGroupMember

Get-ADUser

Export-CSV