How to upgrade users coexistence mode to Teams Only using PowerShell

How to upgrade users coexistence mode to Teams Only using PowerShell

Today I dscovered that not every user in our tenant had coexistence mode set to Teams Only, despite the Org-wide setting said so. Bah! the users own setting overrides the Org-wide. Great, just another thing to remember…

We are a buch of users. And being lazy when I can, I need to brush of my skills in…

PowerShell!

Time to dust off some old PS-skills and get cracking. Okay… not skills per say, but I manage to fiddle my way through it in the end. Google tells me that the cmdlet Grant-CsTeamsUpgradePolicy will do what I need in this case.

Opening PowerShell as Admin and connecting with these commands:

Import-Module SkypeOnlineConnector
$sfbSession = New-CsOnlineSession
Import-PSSession $sfbSession

As a prerequisite, you need to install this Skype-module: https://www.microsoft.com/en-us/download/details.aspx?id=39366

Before we do any changes i need to be sure the Org-wide setting really is set correctly with this cmdlet: Get-CsTeamsUpgradePolicy -Identity Global

Looks good to me!

The next step is to list out the users and see who have wrong coexistence mode: Get-CSOnlineUser | select UserPrincipalName, teamsupgrade*

Yup… almost everyone looked like this

I need them to look like this:

That’s more like it!

The cmdlet for changing this is quite simple: Grant-CsTeamsUpgradePolicy -PolicyName UpgradeToTeams -Identity your@name.com (Just remember to change that last bit…)

But do you need to do this on every single user one by one? Well, no. This is PowerShell! I used this little trick to go through every user and set correct coexistence mode:

$userlist = Get-CSOnlineUser
foreach($User in $userlist)
{
Grant-CsTeamsUpgradePolicy -PolicyName UpgradeToTeams -Identity $User.SipAddress
}

After this had looped through all of my users I verified that all users was set to the correct mode. Job complete!

A little disclaimer. I am NOT a real coder. This little piece her got the job done for me, but I’m sure it could’ve been done more sexy somehow. Feel free to show me in the comments!

One thought on “How to upgrade users coexistence mode to Teams Only using PowerShell

  1. Thank you so much for the blog! It was a lifesaver when trying to migrate my client early in the morning and receiving this very unhelpful error.

    You could perhaps make it sexier by adding a progress bar via ‘Write-Progress’, but I couldn’t figure out how that command works…
    The for each loop did the trick, it took a very long time in our tenant though.

Legg igjen en kommentar

Din e-postadresse vil ikke bli publisert. Obligatoriske felt er merket med *

I accept the Privacy Policy

Dette nettstedet bruker Akismet for å redusere spam. Lær om hvordan dine kommentar-data prosesseres.