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