An Engineers Notebook

Get all X500 addresses in a domain using PowerShell

Run this command in PowerShell with the Active Directory module loaded.

Import-Module ActiveDirectory

Get-ADUser -SearchBase “OU=SBSUsers,OU=Users,OU=MyBusiness,DC=MyDomain,DC=local” -Filter * -Properties SamAccountName,legacyExchangeDN | Select-Object SamAccountName,legacyExchangeDN | Export-CSV C:UserExport.csv -NoTypeInformation

Leave a Reply

Your email address will not be published.