Jump to content

Teams: Applying Education (Secondary school student) package to all students?


Recommended Posts

Posted

Can anyone share their powershell code with me as I need to push the Education (Secondary school student) package (policies) to all my students.

 

I've edited the Education (Secondary school student) policies with a member of SMT and we've tested with a test student everything is how we want it.

 

The polices for the test student look like this:

 

teamspolicies.JPG

 

And I want all my students to look the same :) as currently they are all on Global (Org-wide default) - currently this is fine as I've not given any students apart from the test student a Teams licence.

 

Thanks.

Posted
I used this code

#Connect Teams module
Connect-MicrosoftTeams
#Connect Azure AD module
Connect-AzureAD
$group = Get-AzureADGroup -SearchString "GROUPNAME"
$members = Get-AzureADGroupMember -ObjectId $group.ObjectId -All $true | Where-Object {$_.ObjectType -eq "User"}
New-CsBatchPolicyAssignmentOperation -PolicyType TeamsMessagingPolicy -PolicyName "POLICYNAME" -Identity $members.UserPrincipalName -OperationName "RANDOMDESCRIPNAME"

 

Where GROUPNAME is a group of all your pupils and POLICYNAME is one of the following:

CallingLineIdentity, OnlineVoiceRoutingPolicy, TeamsAppSetupPolicy, TeamsAppPermissionPolicy, TeamsCallingPolicy, TeamsCallParkPolicy, TeamsChannelsPolicy, TeamsEducationAssignmentsAppPolicy, TeamsEmergencyCallingPolicy, TeamsMeetingBroadcastPolicy, TeamsEmergencyCallRoutingPolicy, TeamsMeetingPolicy, TeamsMessagingPolicy, TeamsUpdateManagementPolicy, TeamsUpgradePolicy, TeamsVerticalPackagePolicy, TeamsVideoInteropServicePolicy, TenantDialPlan

 

depending on what policy you want to set.

 

Thanks, I will test this tomorrow - my brain is frazzled for the rest of the day!

Posted
Hi both, I've just tested this script and with a few minor tweaks for my environment, it worked well! Thanks TechMonkey!
Posted

Thanks for this...

 

I had a few weird issues with some groups that came up with errors when trying to apply these settings:-

 

Get-AzureADGroupMember : Cannot convert 'System.Object[]' to the type 'System.String' required by parameter 'ObjectId'. Specified method is not supported.

At line:1 char:45

+ $members = Get-AzureADGroupMember -ObjectId $group.ObjectId -All $tru ...

+ ~~~~~~~~~~~~~~~

+ CategoryInfo : InvalidArgument: (:) [Get-AzureADGroupMember], ParameterBindingException

+ FullyQualifiedErrorId : CannotConvertArgument,Microsoft.Open.AzureAD16.PowerShell.GetGroupMembers

 

But I created new groups in AD with the same users in them and Sync'ed them back to AzureAD and they then seemed to work ok without the error.

 

Is there a command does anyone know that you can run to get a list of all users and see which policy (or policy package) has been assigned to each user to check they have the correct one's being applied?

 

Thanks

 

Matt

Posted

Get-CSOnlineUser will show you the individual policies assigned to the user.

 

The usual -Identity and pipe select will allow you to filter what you are actually looking for

Posted
I used this code

#Connect Teams module
Connect-MicrosoftTeams
#Connect Azure AD module
Connect-AzureAD
$group = Get-AzureADGroup -SearchString "GROUPNAME"
$members = Get-AzureADGroupMember -ObjectId $group.ObjectId -All $true | Where-Object {$_.ObjectType -eq "User"}
New-CsBatchPolicyAssignmentOperation -PolicyType TeamsMessagingPolicy -PolicyName "POLICYNAME" -Identity $members.UserPrincipalName -OperationName "RANDOMDESCRIPNAME"

 

Where GROUPNAME is a group of all your pupils and POLICYNAME is one of the following:

CallingLineIdentity, OnlineVoiceRoutingPolicy, TeamsAppSetupPolicy, TeamsAppPermissionPolicy, TeamsCallingPolicy, TeamsCallParkPolicy, TeamsChannelsPolicy, TeamsEducationAssignmentsAppPolicy, TeamsEmergencyCallingPolicy, TeamsMeetingBroadcastPolicy, TeamsEmergencyCallRoutingPolicy, TeamsMeetingPolicy, TeamsMessagingPolicy, TeamsUpdateManagementPolicy, TeamsUpgradePolicy, TeamsVerticalPackagePolicy, TeamsVideoInteropServicePolicy, TenantDialPlan

 

depending on what policy you want to set.

 

I've now had chance to try the script you kindly posted but unfortunately I get this error!

 

New-CsBatchPolicyAssignmentOperation : The term 'New-CsBatchPolicyAssignmentOperation' is not recognized as the name of a cmdlet, function,

script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

At line:5 char:1

+ New-CsBatchPolicyAssignmentOperation -PolicyType TeamsMessagingPolicy ...

+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (New-CsBatchPolicyAssignmentOperation:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

 

I replaced "GROUPNAME" with "PupilsTeams" and confirmed this group is in AzureAD.

 

I replaced "POLICYNAME" with "Education_SecondaryStudent" the standard one shown in TEAMS Admin.

 

Any thoughts?

Posted
Get-CSOnlineUser will show you the individual policies assigned to the user.

 

The usual -Identity and pipe select will allow you to filter what you are actually looking for

 

Is there anything I need to have installed to get the Get-CSOnlineUser command to be recognised?

 

PS C:\windows\system32> Get-CSOnlineUser

Get-CSOnlineUser : The term 'Get-CSOnlineUser' is not recognized as the name of a cmdlet, function, script file, or

operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try

again.

At line:1 char:1

+ Get-CSOnlineUser

+ ~~~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (Get-CSOnlineUser:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

PS C:\windows\system32>

Posted
Is there anything I need to have installed to get the Get-CSOnlineUser command to be recognised?

 

PS C:\windows\system32> Get-CSOnlineUser

Get-CSOnlineUser : The term 'Get-CSOnlineUser' is not recognized as the name of a cmdlet, function, script file, or

operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try

again.

At line:1 char:1

+ Get-CSOnlineUser

+ ~~~~~~~~~~~~~~~~

+ CategoryInfo : ObjectNotFound: (Get-CSOnlineUser:String) [], CommandNotFoundException

+ FullyQualifiedErrorId : CommandNotFoundException

 

PS C:\windows\system32>

Hey Kenny, it's a tad misleading as this command actually requires the Skype for Business Module - it caught me out too.

 

Here are the steps to connect to it: https://docs.microsoft.com/en-gb/office365/enterprise/powershell/manage-skype-for-business-online-with-office-365-powershell

  • Thanks 1
Posted
Well it did n't take as long as I thought, but it's returned with 73 errors.

 

Anyone know how I troubleshoot this further?

 

[ATTACH=CONFIG]58208[/ATTACH]

 

I think these were accounts that were in the AD group but did not have TEAMS licences or were not part of O365.

 

I've now since created staff policies and moved where necessary everyone off the Global policies where we felt there was a need to differentiate between staff and students.

Posted

Connect-AzureAD

Connect-MicrosoftTeams

 

function Waitfor-policyassignmentComplete ($opid) {

do {

$status = Get-CsBatchPolicyAssignmentOperation -id $opid

Write-Host (get-date -f "HH:mm:ss") $status.OverallStatus ", Waiting..."

Start-Sleep -Seconds 3

} while ($status.OverallStatus -ne "Completed") # wait until operation completed

$status

}

 

# assign policye Education_SecondaryStudent_PrivateCallsAllowed to BON students

$groep = Get-AzureADGroup -SearchString "Licentie.Leerling.BON"

$members = Get-AzureADGroupMember -ObjectId $groep.ObjectId -All $true

$members.count

$upns = $members | Select-Object -ExpandProperty UserPrincipalName

 

$opid = New-CsBatchPolicyAssignmentOperation -Identity $upns -PolicyName "Education_SecondaryStudent_PrivateCallsAllowed" -PolicyType "TeamsCallingPolicy"

Waitfor-policyassignmentComplete -opid $opid

Posted
This thread has been really useful, just applying policies now. In the Admin center under assigned policies for each user there are 2 policies that can be applied that i cannot find the name for to apply from powershell? the live events policy and one that is just called teams policy. All the others i want to apply have been fine.
Posted
This thread has been really useful, just applying policies now. In the Admin center under assigned policies for each user there are 2 policies that can be applied that i cannot find the name for to apply from powershell? the live events policy and one that is just called teams policy. All the others i want to apply have been fine.

 

Live Events I think is TeamsMeetingBroadcastPolicy.

 

Not sure about the other one sorry.

  • Thanks 1
  • 5 months later...
Posted

It would be worth setting your default policy to be as locked down as possible.

This would stop anyone from doing what they are not meant to - plus as an added bonus you'll get a reminder to let them make calls etc :D

Posted
It would be worth setting your default policy to be as locked down as possible.

This would stop anyone from doing what they are not meant to - plus as an added bonus you'll get a reminder to let them make calls etc :D

 

Ideally you would want the default policies set to the most restrictive, then under Meetings/Live Events/Messaging and Calling policies set a Group Policy Assignment for a AD Synchronised group to assign the correct policy (be it Education_Teacher, Education_SecondaryStudent etc).

  • Thanks 1

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 account

Sign in

Already have an account? Sign in here.

Sign In Now



×
×
  • Create New...