The previous period of time to migrate the company's mailbox, related to new and old mailbox account information comparison. The sAMAccountName and alias are not the same mailbox users to collate, do a separate comparison. Here are the commands & scripts:
# Load Exchange, AD module Import-module activedirectoryadd-pssnapin Microsoft.exchange.management.powershell.e2010-erroraction silentlycontinue# get sAMAccountName and alias are not the same as mailbox users $ Mailbox = Get-mailbox-resultsize Unlimited | where {$_. Samaccountname-ne $_. Alias} | foreach {$_. samaccountname}# prepare the output set $globalexport = @ () # round-robin mailbox user foreach ($user in $Mailbox) {$enableuser = Get-aduser-identity $u Ser |? {$_. Enable-eq "True"} $Mail = Get-mailbox-resultsize Unlimited $enableuser. sAMAccountName $Obj = new-object PsObject $Obj | Add-member noteproperty-name "sAMAccountName"-value $Mail. sAMAccountName $OBJ | Add-member Noteproperty-name "Alias"-value $Mail. Alias $OBJ | Add-member noteproperty-name "PrimarySmtpAddress"-value $Mail. PrimarySmtpAddress $OBJ | Add-member noteproperty-name "userPrincipalName"-value $Mail. userprincipalname}# export output to Csv$globalexport | Export-csv f:\scripts\Mailbox.csv-Encoding UTF8
Exchange-Find sAMAccountName and alias mailbox users