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 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

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Elena Rostova

Elena Rostova

Lead Health, Wellness & Medical Journalist

Elena Rostova holds a Master's degree in Public Health Journalism. She covers groundbreaking medical research, holistic wellness trends, mental health awareness, and nutritional science.

Share this article
Twitter Facebook Pinterest