Last active
March 29, 2020 13:12
-
-
Save pmatthews05/4ef20344df45f023a88821891417b901 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param( | |
[Parameter(Mandatory)] | |
[string] | |
$UserNameToSetPolicy, | |
[Parameter(Mandatory)] | |
[string] | |
$PolicyName | |
) | |
Import-Module "C:\\Program Files\\Common Files\\Skype for Business Online\\Modules\\SkypeOnlineConnector\\SkypeOnlineConnector.psd1" | |
$Session = New-CsOnlineSession | |
Import-PSSession -Session:$Session -AllowClobber | |
if (-not $(Get-CsTeamsMessagingPolicy -Identity:$PolicyName -ErrorAction:SilentlyContinue)){ | |
Write-warning "Unable to find Policy $PolicyName" | |
return | |
} | |
else{ | |
Write-Information "Granting Message Policy $PolicyName for user $UserNameToSetPolicy..." | |
Grant-CsTeamsMessagingPolicy -PolicyName $PolicyName -Identity $UserNameToSetPolicy | |
} | |
Remove-PSSession -Session:$session | |
write-Information "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment