During a recent migration, I encountered the following error when attempting to migrate users from Skype for Business Server on Premises, to Microsoft Teams in Office 365:
Object Reference Not Set To an Instance Of An Object
This issue was being caused by an issue with authentication. Essentially, when you run the move-csuser command, you should see a pop-up asking you to authenticate with Office 365 as an Administrator.
In this case, a proxy server was causing issues with blocking this traffic, which was generating the above error.
Two things helped resolve this issue. The first is to ensure you run a proxy connection string prior to running the Move-CSUser command in PowerShell:
#proxy settings for powershell
[system.net.webrequest]::defaultwebproxy = new-object system.net.webproxy('http://your-proxy-here:8080')
[system.net.webrequest]::defaultwebproxy.credentials = [System.Net.CredentialCache]::DefaultNetworkCredentials
[system.net.webrequest]::defaultwebproxy.BypassProxyOnLocal = $true
The second is to use the -UseLegacyMode parameter for your move command:
$url = "https://adminau1.online.lync.com/HostedMigration/hostedmigrationService.svc"
move-csuser -identity firstname.lastname@example.org -target "sipfed.online.lync.com" -hostedmigrationoverrideurl $url -verbose -BypassAudioConferencingCheck -BypassEnterpriseVoiceCheck -UseLegacyMode
I also included Bypass parameters above that skip checking for Audio Conferencing and Enterprise Voice details – useful if you don’t have these enabled within your org.
The UseLegacyMode parameter was added recently to the newer Powershell Cmdlets. You can install these by installing the latest CU Update for Skype for business server (core components – At least August 2021), and installing the latest MicrosoftTeams Powershell Module (Install-MicrosoftTeams -AllowClobber -Force)