How to Bulk Change Teams Upgrade Policy via PowerShell

This post is to document the PowerShell script to bulk change Team upgrade policy: coexistence mode. It is helpful when you are handling a Team migration or you are having an issue with globally enabling “UpgradeToTeams”/ “Teams Only” mode.

Error like below is caused by Teams Public DNS records, but in this case we don’t want to touch some of the domains at this particular time.

PS C:\WINDOWS\system32> Grant-CsTeamsUpgradePolicy -PolicyName UpgradeToTeams -global
Grant-CsTeamsUpgradePolicy :  This organization cannot be upgraded to Teams Only mode. One or more M365 domains have a
public DNS record that points to an on-premises Skype for Business Server deployment. The domain records at fault are {
[,];[,];}. To upgrade this tenant to Teams Only, first complete the migration of all users from on-premises
Skype for Business Server to the cloud (using Move - Cs User), and then disable Skype for Business hybrid
configuration for this tenant and update the DNS records to point to M365. After these steps are complete, you can
execute this command, after which all users and any subsequently created new users will be Teams Only.
At line:1 char:1
+ Grant-CsTeamsUpgradePolicy -PolicyName UpgradeToTeams -global
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Proper Fix for above error is adding new DNS records for it

Bulk enable Teams Only policy for users

Firstly run the PowerShell below to export all your users out

Get-CsOnlineUser | select userprincipalname | Export-Csv C:\temp\allteamsusersexport.csv

You then open it up and clean up make sure the CSV looks like below

[email protected]
[email protected]
[email protected]

Then run the dummy For Loop PowerShell

$users = import-csv c:\temp\allteamsusersexport.csv
foreach ($user in $users){
write-host "To Teams: "$user.UserPrincipalName
Grant-CsTeamsUpgradePolicy -Identity $user.UserPrincipalName -PolicyName UpgradeToTeams}

Useful Link

Grant-CsTeamsUpgradePolicy (SkypeForBusiness) | Microsoft Docs

1 thought on “How to Bulk Change Teams Upgrade Policy via PowerShell”

Leave a Comment

Your email address will not be published. Required fields are marked *