All in 1 magical Script to move bulk users to Teams Only mode from On Premise Skype for Business Servers

move bulk users: When we enable Teams for Skype for Business Hybrid users the final stage of action is to move the actual on premise Skype for Business Account to Office 365 to make them to Teams only mode. As more organization are adopting the Microsoft Teams in a full fast track approach the last stage of migration is to move all the local accounts to Teams Only Mode.

Script to move bulk users to Teams Only mode from On Premise Skype for Business Servers
Script to move bulk users to Teams Only mode from On Premise Skype for Business Servers

This script will help in moving the users on batches to Teams Only Mode from an input csv file. It also provides the time taken to complete the batch on screen once the migration is completed.

Script to move bulk users

Measure-Command {

[CmdletBinding()]

param( [string] $UsersList = $(Read-Host -prompt `

    “Input the CSV File with Location”))

$Users = Import-Csv $UsersList -Delimiter ";"

#To Connect to Teams. Make sure you have the new Teams Module installed.

$admin="enteryouradminaccount@domain.com";

$pwd = "enteryourpasswordhere";

$securepwd = ConvertTo-SecureString $pwd -AsPlainText -Force;

$cred = New-Object Management.Automation.PSCredential ($admin.Replace('sip:', ''), $securepwd);

Import-Module MicrosoftTeams

Connect-MicrosoftTeams

#Initialize parameters and variables.

$sip= $users.SipAddress

$count = $users.count

write-host "We have found" $count "Users to Migrate" -foregroundcolor Yellow -backgroundcolor Black

$pauseSeconds = 10

$Sleep = 20

Write-Host "Pausing for " $pauseSeconds " seconds to verify your count..." -ForegroundColor Yellow

Start-Sleep -s $pauseSeconds

#To Enable Logging and store them for failed migration and any errors.

$transcriptname = “MoveCSUserStatus” + `

    (Get-Date -format s).Replace(“:”,”-“) +”.txt”

Start-Transcript $transcriptname

#Take export of SFB enabled users before move.

$Users | % {get-csuser -Identity $_.SipAddress} | Where-object {$_.Enabled -eq $True} | Select-object  SamAccountName,sipaddress,Enabled,EnterpriseVoiceEnabled | Out-File SFBUsersBeforeMove.csv -append         

#Hosted Migration Override URL - Use the correct URL based on your tenant

$URL= "https://adminof.online.lync.com/HostedMigration/hostedmigrationService.svc"

#Initiate Move-CsUser Operation.

foreach ($user in $users) {

Move-CsUser -Identity $user.SipAddress -Target sipfed.online.lync.com -HostedMigrationOverrideUrl $URL  -MoveToTeams -BypassAudioConferencingCheck -BypassEnterpriseVoiceCheck -Confirm:$False -credential $cred

}

#Pause for 20 seconds

Start-Sleep -s $sleep

#Validate the Move and complete Successfully Moved and Failed Users.

$loop = foreach ($user in $users) {

Get-CsOnlineUser -Identity $user.sipaddress | Select-object  sipaddress,hostingprovider,TeamsUpgradeEffectiveMode,RegistrarPool}

$loop| Out-File TeamsOnlyMigrationStatus.csv -append

#Validate the meeting Migration status

$loop = foreach ($user in $users) {

Get-CsMeetingMigrationStatus -Identity $user.sipaddress | Select-Object UserPrincipalName,State,MigrationType,LastMessage,FailedMeetings}

$loop| Out-File MeetingMigrationStatus.csv -append

Stop-Transcript

Write-Host "Migration Script Completed Please Refer Transcript File for any Errors" -ForegroundColor Green

#Close the sessions.

get-pssession | remove-pssession 

#Send Email report to Notify the Migration have completed - Mention your SMTP server

#Send-MailMessage -from "username@domain.com" -to "admin@domain.com"-subject "TeamsOnlyMigrationTaskCompleted: No File" -body "Teams Only Migration Batch have been completed.Please refer log file Location for further information" -SmtpServer "Mention your SMTP Server"

}

Pointers move bulk users

  1. Make sure that you whitelist the traffic to office365 services to establish successful connection to the SFBO session.
  2. If there are multiple number of users recommended to split up the batches and execute them from 2 servers.
  3. Ensure the SSL traffic inspection, IP connection limits are excluded from Firewall/Proxy from the network side.
  4. Moving this from a shared bandwidth might be a bit slower and moving this from a temporary dedicated IP address might provide a better performance.
  5. This script uses -UseOauth switch. Make sure the Onpremise SFB servers are patched to the required version. Else use the legacy option by removing this switch. Recommended to run this first with few users list verify based on your environment and then later run for bulk users.

Frequently Asked questions

Can we roll-back users to SFB only mode from Teams only mode

Yes, you can by using move-csuser command

Can Teams only user login to SFB application ?

Yes you can however you will get pop up for switch to Teams only mode

Don’t forget to support us by following us on Google News or Returning to the home page TopicsTalk

Join Telegram and WhatsApp for More updates

Follow us on social media

About Sushil G

Hi, my name is Sushil and I am an experienced content writer with a passion for technology. For the past 10 years, I have been specializing in Microsoft products like Azure AD, Exchange, Skype for Business (SFB), and Teams. My in-depth knowledge of these products has enabled me to help many individuals and businesses to achieve their goals by leveraging the power of Microsoft technology. As a content writer, I enjoy taking complex technical concepts and breaking them down into easy-to-understand language. I'm always eager to learn about the latest trends and advancements in the industry and share my knowledge and expertise with others. If you need help in understanding Microsoft products and maximizing their potential, I'm here to help.