Forum Discussion

Ramy AMER's avatar
Ramy AMER
Copper Contributor
Jun 26, 2020

Using UseOAuth switch in the move to Teams command for 100Users password doesnt work all the time

This is my Command below/ first I assign values to $save of the CSV file with list of the user, second run foreach user in users do the move. what happen that script start running and move about 6 to 10 user before it prompt me to add the username and pssword again but it doesnt accept it. I have to click on sign-out and forget password by using the three dots  beside my ID then wait up to 6 minutes before it accept the same username and password again. Issue is this is deleting it purpose instead of having this script [t run on its own and save time I have to deal with the password and its doesn't matter if I am using PS_ISE or Skype PS or Windows PS all version 5 and up.

 

 

Try
    {
   $save = Import-Csv yarab1.csv -Header Identity
                     } 
catch
            {  Write-host "Couldnt find the file!! make sure the file located under  C:\Temp - File Name: Yarab1.csv" -BackgroundColor Black -ForegroundColor red  
            Write-Warning "File is missing or The process cannot access the file because it is being used by another process." -WarningAction Inquire }



Try 
     { $save | Foreach-Object {Move-CsUser -Identity $.identity -Target sipfed.online.lync.com -Confirm:$false -UseOAuth -MoveToTeams -Force -BypassAudioConferencingCheck -BypassEnterpriseVoiceCheck -HostedMigrationOverrideUrl https://adminxx.online.lync.com/HostedMigration/hostedmigrationService.svc}}
     
        catch 
        {Write-Host "An error occurred: $.Identity couldn't be found" -ForegroundColor Yellow -BackgroundColor Red } 
           {catch 
                {Write-Host "Please check if user is enabled in AD or no user object for $.Identity"}
                    Write-Warning "error occurred: moving the user $_.Identity. how do you want to be processed" -WarningAction Inquire
                                                                                                               } 

 

 

  • could you please run below script and share the outcome.

     

    Try { $save = Import-Csv yarab1.csv -Header Identity } catch { Write-host "Couldnt find the file!! make sure the file located under C:\Temp - File Name: Yarab1.csv" -BackgroundColor Black -ForegroundColor red Write-Warning "File is missing or The process cannot access the file because it is being used by another process." -WarningAction Inquire } foreach ($save in $save1) { Try { $save1 Move-CsUser -Identity $.identity -Target sipfed.online.lync.com -Confirm:$false -UseOAuth -MoveToTeams -Force -BypassAudioConferencingCheck -BypassEnterpriseVoiceCheck -HostedMigrationOverrideUrl https://adminxx.online.lync.com/HostedMigration/hostedmigrationService.svc} catch {Write-Host "An error occurred: $.Identity couldn't be found" -ForegroundColor Yellow -BackgroundColor Red } {catch {Write-Host "Please check if user is enabled in AD or no user object for $.Identity"} Write-Warning "error occurred: moving the user $_.Identity. how do you want to be processed" -WarningAction Inquire } }

Resources