Wednesday, 16 July 2014

Assigning Office 365 options to users (Basic)


I have recently been working with a school who have signed up to Microsoft’s OVS-ES service, as a part of this they are entitled to apply for Student Advantage licenses which will allow pupils to download and install an up to date version of Office on up to 5 devices at home. In order to access this feature the school need to sign up for an Office 365 account and to use the A2 (Free) service.
Administrators can apply licenses to staff and pupils through a website, however this only allows you to modify a limited number of users at a time but Microsoft have been generous and provided a means of automating some of these processes using PowerShell.
In order to accomplish this you will require the Windows Azure Components installed on your computer, once these are installed you will be able to use PowerShell to connect and work with your Office 365 service.
The script below is an example of PowerShell code which will allow you to apply a license to users within a certain department (AD Attribute), once this license has been applied any restrictions you wish on the services within the license are added.
This script could be amended to work with Pupil users by editing the License used and the Department searched for, however the script is very basic and will not take into account any users who may have conflicting entries to those you set, I have not tested this scenario.
I will follow up on this basic post with a more comprehensive one which will allow you to pick the department and license you wish to apply based on basic text menu’s presented in the shell but for now this will give you something to be going on with.
1 ################################################################################### 2 # Marc Hundley 3 # 4 # Version 0.1 5 # 6 # 16/07/2014 7 # 8 # Purpose : Allocating with restrictions access for Staff to the O365 tools online 9 ################################################################################### 10 #11 # Requirements 12 # ------------ 13 #14 # Windows Azure Components 15 # Office 365 online account 16 #17 ###### 18 #19 # Suitable amount of licenses to allocate to staff 20 #21 ###### 22 #23 # Knowledge of TENANT_ID - can be obtained by using the following commands : 24 #25 # import-module MSOnline 26 # $msolcred = Get-Credential 27 # Connect-MsolService -Credential $msolcred 28 # $licenses = Get-MsolAccountSku 29 # $licenses 30 #31 # This will give you all of the available licenses, the TENANT_ID will be the 32 # common factor before the : 33 #34 ###### 35 #36 # Edit the -DisabledPlans entry depending on the needs of the customer, these 37 # can be obtained with the command : 38 #39 # import-module MSOnline 40 # $msolcred = Get-Credential 41 # Connect-MsolService -Credential $msolcred 42 # $licenses = Get-MsolAccountSku 43 # $licenses[x].ServiceStatus 44 #45 # Where [x] is the license you wish to view (array starting at 0) 46 #47 # Options for the STANDARDWOFFPACK_FACULTY are as follows 48 #49 # YAMMER_EDU 50 # SHAREPOINTWAC_EDU 51 # MCOSTANDARD 52 # SHAREPOINTSTANDARD_EDU 53 # EXCHANGE_S_STANDARD 54 #55 ###### 56 #57 # Staff members are to be members of the Staff department in Active Directory 58 # which has synchronised with Office 365 59 #60 ################################################################################### 61 62 #Import O365 Azure module 63 import-module MSOnline64 #Clear Screen 65 cls66 67 #Connect to Office 365 with admin credentials 68 $msolcred = Get-Credential69 Connect-MsolService -Credential $msolcred 70 71 #get users 72 $users = Get-MsolUser -Department "Staff" -MaxResults 2500 73 74 #Assign faculty pack exclusions to variable (edit disabledplans as needed by customer) 75 $myO365Sku = New-MsolLicenseOptions -AccountSkuId <TENANT_ID>:STANDARDWOFFPACK_FACULTY -DisabledPlans EXCHANGE_S_STANDARD76 77 #Assign components for each user 78 foreach ($user in $users) {79 $username = $user.UserPrincipalName80 write-Host "Assigning License for "$username 81 #Add Overall license (required before setting restrictions) 82 Set-MsolUserLicense -UserPrincipalName $username -AddLicenses <TENANT_ID>:STANDARDWOFFPACK_FACULTY83 #Assign exclusions 84 Set-MsolUserLicense -UserPrincipalName $username -LicenseOptions $myO365Sku 85 }

No comments:

Post a comment

Please enter your comment here, all comments are subject to moderation