mrssevage Posted June 22, 2020 Posted June 22, 2020 Hi, I would like to assign custom policy to all my students (team and messaging). Is there easier way to do it than PowerShell? If not, would I use below one? Assign all users in the group to a particular teams policy. In this example, it's Marketing Teams Policy. $members | ForEach-Object { Grant-CsTeamsChannelsPolicy -PolicyName "Marketing Teams Policy" -Identity $_.UserPrincipalName} Thank you, M
kennysarmy Posted June 22, 2020 Posted June 22, 2020 I used this: #Connect Teams module Connect-MicrosoftTeams #Connect Azure AD module Connect-AzureAD $group = Get-AzureADGroup -SearchString "CAGPupils" $members = Get-AzureADGroupMember -ObjectId $group.ObjectId -All $true | Where-Object {$_.ObjectType -eq "User"} New-CsBatchPolicyPackageAssignmentOperation -Identity $members.UserPrincipalName -PackageName "Education_SecondaryStudent" The above returns an ID, this can be used to check on the status of the operation: Get-CsBatchPolicyAssignmentOperation -OperationId 9b0ad80e-5071-4eb3-b5fc-ac655a5ff3aa | fl 1
NicholasEsping Posted June 22, 2020 Posted June 22, 2020 I would recommend using the batch method of assigning policies. you create a txt document with a list of UPNs and then run Connect-MicrosoftTeams $user_ids = Get-Content C:\users_ids.txt New-CsBatchPolicyAssignmentOperation -PolicyType TeamsChannelsPolicy -PolicyName "Student Teams Policy" -Identity $user_ids -OperationName "Student Teams batch" https://docs.microsoft.com/en-us/powershell/module/teams/new-csbatchpolicyassignmentoperation?view=teams-ps 1
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now