Provision E3 license through PowerShell (and take away apps)


These directions will show how to provision an Office 365 E3 license through PowerShell, and take away some apps.

Connect to O365 in Powershell

- Open PowerShell ISE
- Run this script

Install-Module -Name AzureAD
Connect-AzureAD

Connect-MsolService 

- Sign into Office 365 when prompted as a global admin

Set the usage location

- Run this script
Set-MsolUser -UserPrincipalName "userprinciplename@contoso.com" -UsageLocation US 

Tip:
You can find all users that do not have a user location assigned by running this command:

Get-MsolUser -All | where {$_.UsageLocation -eq $null

Turn on the E3 license

Set-MsolUserLicense -UserPrincipalName "userprinciplename@contoso.com" -AddLicenses "contoso:ENTERPRISEPACK"

Hint
To see what licenses you have available, run this:
Get-MsolAccountSku

Remove Unnecessary Apps

$LO = New-MsolLicenseOptions -AccountSkuId "contoso:ENTERPRISEPACK" -DisabledPlans "MCOSTANDARD", "BPOS_S_TODO_2", "FORMS_PLAN_E3", "FLOW_O365_P2", "POWERAPPS_O365_P2", "SWAY", "YAMMER_ENTERPRISE", "RMS_S_ENTERPRISE", "EXCHANGE_S_ENTERPRISE", "Deskless", "PROJECTWORKMANAGEMENT"

Set-MsolUserLicense -UserPrincipalName "userprinciplename@contoso.com" -LicenseOptions $LO

To change licenses, re-run this with different options

When plugging this into Excel, an example formula to use is:
=CONCAT("Set-MsolUserLicense -UserPrincipalName """, D2, """ -LicenseOptions $LO")


Hint
You can get a list of apps to turn off or on for $LO using this powershell:
Get-MsolAccountSku | Where-Object AccountSkuId -like '*enterprisepack*' | Select-Object -ExpandProperty ServiceStatus 


Sources





Share on Google Plus

About Tom DeMeulenaere

Highly accomplished information technology professional with extensive knowledge in System Center Configuration Manager, Windows Server, SharePoint, and Office 365.
    Blogger Comment

0 comments:

Post a Comment

Note: Only a member of this blog may post a comment.