SOLVED

Move some users to "Teams Only" mode with powershell

Copper Contributor
Does anyone have a script that will move users in bulk from islands mode to ms teams only please?
20 Replies
best response confirmed by Chad Rodriguez (Copper Contributor)
Solution

This is a simple script that reads sip address from a csv file and change mode.

 

$Users = Import-Csv -Path c:\temp\users.csv

foreach($User in $Users)
{

Grant-CsTeamsUpgradePolicy -Identity $User.SipAddress -PolicyName UpgradeToTeams

}

 

If you want to change for all users in your organisation you can change the default mode instead. Teams Admin Center > Org-wide Settings > Teams Upgrade, change Coexistence mode to Teams only.

clipboard_image_0.png

Linus will this work if i have a current csv with a column titled: UserPrincipalName username@company.com ?
I get this error: $Users = Import-Csv -Path c:\temp\TeamsOnlyMode.csv foreach($User in $Users) { Grant-CsTeamsUpgradePolicy -Identity $User.SipAddress -PolicyName UpgradeToTeams } Grant-CsTeamsUpgradePolicy : The term 'Grant-CsTeamsUpgradePolicy' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:6 char:1 + Grant-CsTeamsUpgradePolicy -Identity $User.SipAddress -PolicyName Upg ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : ObjectNotFound: (Grant-CsTeamsUpgradePolicy:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException
Figured it out Linus, but what if i want to notify the Skype for Business user? #Connect using a Skype for Business Online administrator account with multifactor authentication Import-Module SkypeOnlineConnector $sfbSession = New-CsOnlineSession Import-PSSession $sfbSession $Users = Import-Csv -Path c:\temp\TeamsOnlyMode.csv foreach($User in $Users) { Grant-CsTeamsUpgradePolicy -Identity $User.UserPrincipalName -PolicyName UpgradeToTeams }

Hi,

 

Great that you figured it out. 

 

You can't set the notify user switch when switching them to TeamsOnly, since when they are in TeamsOnly mode they will not use the Skype client anymore. So that you have to inform them about with a good user adoption. 

Just wondering what that switch looks like, do you happen to know please?

@Chad Rodriguez It is not a separate switch for notifying users it is different modes. So for SfBWithTeamsCollab you have SfBWithTeamsCollab and SfBWithTeamsCollabWithNotify

 

Grant-CsTeamsUpgradePolicy -Identity $User.SipAddress -PolicyName SfBWithTeamsCollabWithNotify

or

Grant-CsTeamsUpgradePolicy -Identity $User.SipAddress -PolicyName SfBWithTeamsCollab

 

@Chad Rodriguez 

 

could you share your script for moving users to teams only mode..

@Linus Cansby same way i am getting error i want to know from which machine i want run the script 

@Linus Cansby 

 

can you send me to my email address ramece1987@gmail.com for the further explaination  i want to complete the 100 user to activat teams useing powershell script 

@Ram_vignesh1987 If you are moving from Skype for Business Online to Teams you can run it from any machine, just connect to Skype for Business Online Powershell.

@Linus Cansby 

Do we first connect o365 in powershell then run the script in the powershell even i am not able to find 

 

@Linus Cansby 

 

PS C:\Users\Ram_Vignesh> cd c:\
PS C:\> $Users = Import-Csv -Path c:\users.csv
PS C:\> foreach($User in $Users)
>> { Grant-CsTeamsUpgradePolicy -Identity $User. UserPrincipalName -PolicyName UpgradeToTeams }
Grant-CsTeamsUpgradePolicy : The term 'Grant-CsTeamsUpgradePolicy' is not recognized as the name of a cmdlet,
function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the
path is correct and try again.
At line:2 char:3
+ { Grant-CsTeamsUpgradePolicy -Identity $User. UserPrincipalName -Poli ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (Grant-CsTeamsUpgradePolicy:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException

 

 

facing the error could tell me the reason for the error 

@Ram_vignesh1987 Check this document to download Skype for Business Online powershell module and then how to connect to SfB Online to run the command.

 

https://docs.microsoft.com/en-us/office365/enterprise/powershell/connect-to-all-office-365-services-...

@Linus Cansby What should be the .csv file look like. I used the userpricipalname in tab and the user name below it? That did not help me. Please share if there is an example file. Thanks

foreach($User in $Users)
{
Grant-CsTeamsUpgradePolicy -Identity $User.SipAddress -PolicyName UpgradeToTeams
}
Cannot validate argument on parameter 'Identity'. The argument is null or empty. Provide an argument that is not null or empty, and
then try the command again.
+ CategoryInfo : InvalidData: (:) [Grant-CsTeamsUpgradePolicy], ParameterBindingValidationException
+ FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Rtc.Management.AD.Cmdlets.AssignCSTeamsUpgradePolicyCmdlet
+ PSComputerName : admin3a.online.lync.com

@NARASA SARAT MEDAPALLI 

Header with SipAddress and then one sip address per row:

 

SipAddress
user1@contoso.com

user2@contoso.com

Yup! “ $User.SipAddress” means selecting the “sipaddress” field in the CSV for every user the scripts loops through, so in this case header must be sipaddress
1 best response

Accepted Solutions
best response confirmed by Chad Rodriguez (Copper Contributor)
Solution

This is a simple script that reads sip address from a csv file and change mode.

 

$Users = Import-Csv -Path c:\temp\users.csv

foreach($User in $Users)
{

Grant-CsTeamsUpgradePolicy -Identity $User.SipAddress -PolicyName UpgradeToTeams

}

 

If you want to change for all users in your organisation you can change the default mode instead. Teams Admin Center > Org-wide Settings > Teams Upgrade, change Coexistence mode to Teams only.

clipboard_image_0.png

View solution in original post