Learn how to provision tenants, synchronize on-premise Active Directory, implement Single Sign-On, customize Office deployment, and protect your organization with eDiscovery and DLP policies. Only from Platform Scholar.
I hobbled this together from several sources. When I ran it, I got an error about the account in the resource forest not being disabled. I disabled it in ADUC and ran the script again. This time is linked but the user had an empty mailbox. I can find no trace of the 2.5GB mailbox he was using before.
$Arg1 = "username" #same in account and resource forests) $username = "accountforest\admin" $password = ConvertTo-SecureString -String "********" -AsPlainText -Force $cred = New-object -typename System.Management.Automation.PSCredential -argumentlist $username, $password Disable-Mailbox -Identity $Arg1 Enable-Mailbox -Identity $Arg1 -Alias $Arg1 -Database 'DB05' -LinkedMasterAccount 'accountforest.priv\username' -LinkedDomainController 'dc01.accountforest.priv' -LinkedCredential:$cred Set-Mailbox -Id $arg1 -customAttribute1 "CompanyName"
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
Join the community of 500,000 technology professionals and ask your questions.