Last active
May 11, 2017 01:48
-
-
Save mattmcnabb/046774cab99eecb091a458ea407f752b to your computer and use it in GitHub Desktop.
Blog_Office-365-Licensing_4
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
$LicenseTemplate = @( | |
@{ | |
AccountSkuId = 'whitehouse:ENTERPRISEPACK' | |
EnabledPlans = 'EXCHANGE_S_STANDARD','SHAREPOINTENTERPRISE','SHAREPOINTWAC','MCOSTANDARD','YAMMER_ENTERPRISE' | |
}, | |
@{ | |
AccountSkuId = 'whitehouse:PROJECTONLINE' | |
EnabledPlans = 'SWAY' | |
} | |
) |
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
$AccountSkuIds = Get-MsolAccountSku | |
$LicenseOptions = foreach ($Item in $LicenseTemplate) | |
{ | |
$AllPlans = ($AccountSkuIds | Where-Object AccountSkuId -eq $Item.AccountSkuId).ServiceStatus | |
$DisabledPlans = ($AllPlans | Where-Object { $_.ServicePlan.ServiceName -notin $Item.EnabledPlans }).ServicePlan.ServiceName | |
New-MsolLicenseOptions -AccountSkuId $Item.AccountSkuId -DisabledPlans $DisabledPlans | |
} |
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
try | |
{ | |
$Splat = @{ | |
UserPrincipalName = abe.lincoln@whitehouse.gov | |
AddLicenses = whitehouse:ENTERPRISEPACK | |
LicenseOptions = $Options | |
} | |
Set-MsolUserLicense @Splat -ErrorAction Stop | |
} | |
catch [Microsoft.Online.Administration.Automation.MicrosoftOnlineException] | |
{ | |
$Splat.Remove('AddLicenses') | |
Set-MsolUserLicense @Splat -ErrorAction Stop | |
} |
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
# Sales users will get Exchange and Skype | |
# Engineers will get Exchange and Sharepoint | |
$Sales = Get-MsolUser -Department Sales -All | |
$Engineering = Get-MsolUser -Department Engineering -All | |
$SalesTemplate = @{ | |
AccountSkuId = "contoso:ENTERPRISEPACK" | |
EnabledPlans = "EXCHANGE_S_STANDARD","MCOSTANDARD" | |
} | |
$EngineeringTemplate = @( | |
@{ | |
AccountSkuId = contoso:ENTERPRISEPACK | |
EnabledPlans = "EXCHANGE_S_STANDARD" | |
}, | |
@{ | |
AccountSkuId = "contoso:PROJECTONLINE" | |
EnabledPlans = "SHAREPOINT_PROJECT","SHAREPOINTENTERPRISE" | |
} | |
) | |
$Sales | Set-O365UserLicense -LicenseTemplate $SalesTemplate | |
$Engineering | Set-O365UserLicense -LicenseTemplate $EngineeringTemplate |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment