Forum Discussion
Daniel Smith
Mar 23, 2020Copper Contributor
PowerShell in Teams for Members of a Messaging Policy
Dear All
I can use PowerShell to see what Messaging Policy a single user belongs to:
Get-CsOnlineUser -Identity jbloggs | Format-Table UserPrincipalName, TeamsMessagingPolicy
How do I see all the users that belong to a particular Messaging Policy, for example, a messaging policy called 'Students - No Chat'?
I have a policy which I am unable to delete because it says one or more users are still assigned to it but I don't know who they are to remove them.
Many thanks for your help
Dan
Hi,
This should work:
Get-CsOnlineUser | Where-Object {$_.TeamsMessagingPolicy -eq "Students - No Chat"} | fl Identity,TeamsMessagingPolicy
And to set it back to Global use:
Get-CsOnlineUser | Where-Object {$_.TeamsMessagingPolicy -eq "Students - No Chat"} | Grant-CsTeamsMessagingPolicy -PolicyName $null
- CLadminCopper Contributor
Can I use powershell to apply message policy to a group? I dont want to go into every students account and add that policy? I do have all the students in a group called "Students"
Any help would be awesome!CLadmin Yes that is possible, you have to use the preview module of Microsoft Teams Powershell. Check this article from paul-lange
https://paul-lange.net/assign-policies-in-microsoft-teams-the-easy-way/