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

%3CLINGO-SUB%20id%3D%22lingo-sub-1491296%22%20slang%3D%22en-US%22%3EUsing%20UseOAuth%20switch%20in%20the%20move%20to%20Teams%20command%20for%20100%20password%20doesnt%20work%20all%20the%20time%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1491296%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSTRONG%3EThis%20is%20my%20Command%26nbsp%3Bbelow%2F%20first%20I%20assign%26nbsp%3Bvalues%26nbsp%3Bto%20%24save%20of%20the%20CSV%20file%20with%20list%20of%20the%20user%2C%20second%20run%20foreach%20user%20in%20users%20do%20the%20move.%20what%20happen%20that%20script%20start%20running%20and%20move%20about%206%20to%2010%20user%20before%20it%20prompt%20me%20to%20add%20the%20username%20and%20pssword%20again%20but%20it%20doesnt%20accept%20it.%20I%20have%20to%20click%20on%20sign-out%26nbsp%3Band%20forget%20password%20by%20using%20the%20three%20dots%26nbsp%3B%20beside%20my%20ID%20then%20wait%20up%20to%206%20minutes%20before%20it%20accept%20the%20same%20username%20and%20password%20again.%20Issue%20is%20this%20is%20deleting%26nbsp%3Bit%20purpose%26nbsp%3Binstead%20of%20having%20this%20script%20%5Bt%20run%20on%20its%20own%20and%20save%20time%20I%20have%20to%20deal%20with%20the%20password%20and%20its%20doesn't%26nbsp%3Bmatter%20if%20I%20am%20using%20PS_ISE%20or%20Skype%20PS%20or%20Windows%20PS%20all%20version%205%20and%20up.%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CPRE%20class%3D%22lia-code-sample%20language-powershell%22%3E%3CCODE%3ETry%0A%20%20%20%20%7B%0A%20%20%20%24save%20%3D%20Import-Csv%20yarab1.csv%20-Header%20Identity%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%0Acatch%0A%20%20%20%20%20%20%20%20%20%20%20%20%7B%20%20Write-host%20%22Couldnt%20find%20the%20file!!%20make%20sure%20the%20file%20located%20under%20%20C%3A%5CTemp%20-%20File%20Name%3A%20Yarab1.csv%22%20-BackgroundColor%20Black%20-ForegroundColor%20red%20%20%0A%20%20%20%20%20%20%20%20%20%20%20%20Write-Warning%20%22File%20is%20missing%20or%20The%20process%20cannot%20access%20the%20file%20because%20it%20is%20being%20used%20by%20another%20process.%22%20-WarningAction%20Inquire%20%7D%0A%0A%0A%0ATry%20%0A%20%20%20%20%20%7B%20%24save%20%7C%20Foreach-Object%20%7BMove-CsUser%20-Identity%20%24.identity%20-Target%20sipfed.online.lync.com%20-Confirm%3A%24false%20-UseOAuth%20-MoveToTeams%20-Force%20-BypassAudioConferencingCheck%20-BypassEnterpriseVoiceCheck%20-HostedMigrationOverrideUrl%20https%3A%2F%2Fadminxx.online.lync.com%2FHostedMigration%2FhostedmigrationService.svc%7D%7D%0A%20%20%20%20%20%0A%20%20%20%20%20%20%20%20catch%20%0A%20%20%20%20%20%20%20%20%7BWrite-Host%20%22An%20error%20occurred%3A%20%24.Identity%20couldn't%20be%20found%22%20-ForegroundColor%20Yellow%20-BackgroundColor%20Red%20%7D%20%0A%20%20%20%20%20%20%20%20%20%20%20%7Bcatch%20%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7BWrite-Host%20%22Please%20check%20if%20user%20is%20enabled%20in%20AD%20or%20no%20user%20object%20for%20%24.Identity%22%7D%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20Write-Warning%20%22error%20occurred%3A%20moving%20the%20user%20%24_.Identity.%20how%20do%20you%20want%20to%20be%20processed%22%20-WarningAction%20Inquire%0A%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%7D%20%3C%2FCODE%3E%3C%2FPRE%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-1491296%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EPowerShell%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESkype%20for%20Business%20Server%20on%20premises%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ETeams%20Migration%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1504936%22%20slang%3D%22en-US%22%3ERe%3A%20Using%20UseOAuth%20switch%20in%20the%20move%20to%20Teams%20command%20for%20100Users%20password%20doesnt%20work%20all%20the%20tim%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1504936%22%20slang%3D%22en-US%22%3E%3CP%3Ecould%20you%20please%20run%20below%20script%20and%20share%20the%20outcome.%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3ETry%20%7B%20%24save%20%3D%20Import-Csv%20yarab1.csv%20-Header%20Identity%20%7D%20catch%20%7B%20Write-host%20%22Couldnt%20find%20the%20file!!%20make%20sure%20the%20file%20located%20under%20C%3A%5CTemp%20-%20File%20Name%3A%20Yarab1.csv%22%20-BackgroundColor%20Black%20-ForegroundColor%20red%20Write-Warning%20%22File%20is%20missing%20or%20The%20process%20cannot%20access%20the%20file%20because%20it%20is%20being%20used%20by%20another%20process.%22%20-WarningAction%20Inquire%20%7D%20foreach%20(%24save%20in%20%24save1)%20%7B%20Try%20%7B%20%24save1%20Move-CsUser%20-Identity%20%24.identity%20-Target%20sipfed.online.lync.com%20-Confirm%3A%24false%20-UseOAuth%20-MoveToTeams%20-Force%20-BypassAudioConferencingCheck%20-BypassEnterpriseVoiceCheck%20-HostedMigrationOverrideUrl%20%3CA%20href%3D%22https%3A%2F%2Fadminxx.online.lync.com%2FHostedMigration%2FhostedmigrationService.svc%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fadminxx.online.lync.com%2FHostedMigration%2FhostedmigrationService.svc%3C%2FA%3E%7D%20catch%20%7BWrite-Host%20%22An%20error%20occurred%3A%20%24.Identity%20couldn't%20be%20found%22%20-ForegroundColor%20Yellow%20-BackgroundColor%20Red%20%7D%20%7Bcatch%20%7BWrite-Host%20%22Please%20check%20if%20user%20is%20enabled%20in%20AD%20or%20no%20user%20object%20for%20%24.Identity%22%7D%20Write-Warning%20%22error%20occurred%3A%20moving%20the%20user%20%24_.Identity.%20how%20do%20you%20want%20to%20be%20processed%22%20-WarningAction%20Inquire%20%7D%20%7D%3C%2FP%3E%3C%2FLINGO-BODY%3E
Highlighted
Occasional Contributor

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
                                                                                                               } 

 

 

1 Reply
Highlighted

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