Office365 Powershell Assign Services

From Michael's Information Zone
Revision as of 08:30, 27 June 2017 by Michael.mast (talk | contribs) (Created page with "So Microsoft did a stupid with assinging Office services via powershell. With mail boxes you can use simple boolean values to enable/disable services. However, with Office you...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

So Microsoft did a stupid with assinging Office services via powershell. With mail boxes you can use simple boolean values to enable/disable services. However, with Office you have to remove the license and re-apply with the options you require. Not an issue if they would have documented these things.

The first issue was trying to find out what the services were called. Whoever came up with these names is as bad as I am when it comes to naming things.

Get-MsolUser -UserPrincipalName $user).Licenses.ServiceStatus 

FORMS_PLAN_E1                   Success          
FLOW_O365_P1                    Success          
POWERAPPS_O365_P1               Success          
O365_SB_Relationship_Management Success          
TEAMS1                          Success          
PROJECTWORKMANAGEMENT           Success          
SWAY                            Disabled         
INTUNE_O365                     PendingActivation
SHAREPOINTWAC                   Success          
OFFICE_BUSINESS                 Success          
YAMMER_ENTERPRISE               Success          
EXCHANGE_S_STANDARD             Success          
MCOSTANDARD                     Success          
SHAREPOINTSTANDARD              Success          

The next step was to remove the license and re-apply. The key here is to create the options as it's own object, then embed into the license assignment as a variable.

Connect-MsolService -Credential $cred
$user="<user principle name>"
$disable=New-MsolLicenseOptions -AccountSkuId <business name>:O365_BUSINESS_PREMIUM -DisabledPlans SWAY,FORMS_PLAN_E1,FLOW_O365_P1,POWERAPPS_O365_P1,TEAMS1,PROJECTWORKMANAGEMENT,SHAREPOINTWAC,YAMMER_ENTERPRISE,SHAREPOINTSTANDARD
Set-MsolUserLicense -UserPrincipalName $user -RemoveLicenses <business name>:O365_BUSINESS_PREMIUM
Set-MsolUser -UserPrincipalName $user -UsageLocation US
Set-MsolUserLicense -UserPrincipalName $user -AddLicenses <business name>:O365_BUSINESS_PREMIUM -LicenseOptions $disable