Move-Csuser Bulk Move Prompt After 10-15 Users
I Am Wanting to Migrate Users from Sfb 2015 Cu 11 to Skypeonline/Teams I Connect Once and Create a Session Successfully Here Is My Move Command Which I Then...
I am wanting to migrate users from SfB 2015 CU 11 to SkypeOnline/Teams
I connect once and create a session successfully
Here is my Move command which I then run in a loop for a batch of users
Move-CsUser -Identity $user -Target sipfed.online.lync.com -Credential $creds -HostedMigrationOverrideUrl $url -ProxyPool $SfbPool -DomainController $DCName -ErrorAction Stop -UseOAuth -Confirm:$False
However after moving 10-15 users, I get a OAuth Microsoft window come up that the account executing the migration was not able to be used. And if I wait for a little while (2-3 mins) and try again it works again after that. Then the cycle repeats. Any idea why this may be happening? Is it throttling activity?
Thanks in advance, Jake.
3 Answers
I'm not completely sure if this is the case, but this sounds like the remote session module timeout I was plagued with in my Exchange online remote sessions.
If you use "Import-PSSession" in your script, this could very well be the problem.
To resolve that timeout issue, you export your PS session to your local modules path, and then import the module into your script. You don't need to use Import-PSSession after that, and since you're using a local module, it doesn't timeout, and you're not prompted for creds again.
Here's the command I used to export my exchange session to a local path.
Export-PsSession -session $Session -CommandName get-*, add-*, enable-*, new-* -outputModule “$path\Exchange” -encoding ASCII -AllowClobber -Force
I've experienced the same when moving users. My findings were, that if I choose to sign in in the prompt with another account, but use the same email, script continues to run, however asks for account input. I think optional parameter that is presented "-TenantAdminUserName" can do the trick.
It seems to be fixed with a Wait between each Move: Start-Sleep -s 45