Home » news »

How to assign Microsoft Teams policies with PowerShell


How to work with Microsoft Teams policies in PowerShell

Originally, the PowerShell commands used to manage Microsoft Teams belonged to the Skype for Business Online Connector. Microsoft retired Skype for Business Online on July 31; organizations must switch from the Skype for Business Online Connector and use the latest version of the Microsoft Teams PowerShell module instead.

To start, install the Microsoft Teams module using PowerShell. The system must be running Windows PowerShell version 5.1 or higher and have the .NET Framework 4.7.2 or later installed. Install PowerShellGet with following command:

Install-Module -Name PowerShellGet -Force -AllowClobber

Next, install the Microsoft Teams module.

Install-Module -Name MicrosoftTeams -Force -AllowClobber

If that fails, import the module into the current PowerShell session with the following command:

Import-Module MicrosoftTeams

Next, connect to Microsoft Teams Once connected, the commands are available to set up and configure Microsoft Teams policies. For example, to see the list of all messaging policies, execute the following command:


Each configured policy type will return with its property name and current value.

To create a messaging policy, use the New-CsTeamsMessagingPolicy command. The following example denies the user access to post giphys and memes.

New-CsTeamsMessagingPolicy `
      -Identity DemoMessagingPolicy `
      -AllowGiphy $false `
      -AllowMemes $false

To update an existing policy, use the Set-CsTeamsMessagingPolicy command for the corresponding policy type. For example, uses the following command to update a policy named DemoMessagingPolicy to restrict sticker use:

Set-CsTeamsMessagingPolicy `
      -Identity DemoMessagingPolicy `
      -AllowStickers $false

The PowerShell commands to create policies are similar in syntax and usage. Microsoft provides more information about each Teams policy command in its Skype for Business documentation:

  • New-CsTeamsMeetingPolicy
  • New-CsTeamsMessagingPolicy
  • New-CsTeamsAppSetupPolicy
  • New-CsTeamsCallingPolicy (documentation missing)
  • New-CsTeamsMeetingBroadcastPolicy
  • New-CsTeamsChannelsPolicy

Related Posts

  • No Related Posts