Office 365 Licensing with Powershell

The Basics

Recently I’ve had to explore the dark art of license assignment using Powershell. It’s not particularly well documented so this might help you…

Displaying a list of the current licensing assignment is pretty straightforward. Get-MsolUser can be used to return information on an individual or a list of users.

Get-MsolUser -All run on its own will return all of the users available in the tenant along with whether or not there is a user license assigned.

To make this a bit more usable, you could pipe this output to a CSV file and work with it from there

Get-MsolUser | Export-Csv c:\path\AllUsers.CSV

If you want to filter it a bit more you can user the “TRUE” or “FALSE” options

Get-MsolUser | Where-Object {$_.isLicensed -eq “TRUE”} | Export-Csv c:\path\AllUsersWithLicenses.CSV

First Time License Assignment

The next step from here is to know what licensing SKU you have available before you can apply it. The first thing you will need to do is obtain the AccountSkuId values that have been setup for your tenant.

In my case, I have an E3 tenant which is an ENTERPRISEPACK AccountSkuId that is prefixed with the name of my tenant. You need to display your SKU:

Get-MsolAccountSku | Format-Table AccountSkuId, SkuPartNumber

If you have an E4 subscription, the AccountSkuId is ENTERPRISEPACKWITHCAL

The available service plans in each of these are

  • OFFICESUBSCRIPTION (Office Pro Plus)
  • MCOSTANDARD (Lync Online)
  • SHAREPOINTWAC (Office Web Apps)
  • SHAREPOINTENTERPRISE (Sharepoint Online)
  • EXCHANGE_S_ENTERPRISE (Exchange Online)

In the Kiosk plans the AccountSkuId is DESKLESSWOFFPACK and this contains:

  • SHAREPOINTWAC
  • SHAREPOINTDESKLESS
  • EXCHANGE_S_DESKLESS

The Exchange Online Archiving SKU contains:

  • EXCHANGE_S_ARCHIVE

Doing bulk license assignments you’ll need to create a CSV file containing the UPN for each batch you want to license. I’ve names the column in my CSV “UPN”

Then you’ll need to set the licenses you would like to disable, in my example I only want to assign a license for Office Pro Plus so I need to set a variable which contains my assignment:

$Step1 = New-MsolLicenseOptions -AccountSkuId klouds:ENTERPRISEPACK -DisabledPlans MCOSTANDARD,SHAREPOINTWAC,SHAREPOINTENTERPRISE,EXCHANGE_S_ENTERPRISE

When assigning a license for the first time you also need to specify the country of use

Import-Csv .\Sample.CSV | foreach {set-MsolUser -UserPrincipalName $_.UPN -UsageLocation AU}

The next step is to assign the license:

Import-Csv .\Sample.CSV | foreach {Set-MsolUserLicense -UserPrincipalName $_.UPN -AddLicenses klouds:ENTERPRISEPACK -verbose -LicenseOptions $Step1}

You can check the license assignment with:

(Get-MSOLUser –UserPrincipalName “Your UPN”).Licenses[0].ServiceStatus

Modifying Subscriptions within a License

As with the first time license assignment, you will need to set a variable containing the license subscriptions you want to activate. In my example I am going to remove the Office Pro Plus subscription and activate Exchange Online:

$Step2 = New-MsolLicenseOptions -AccountSkuId klouds:ENTERPRISEPACK -DisabledPlans OFFICESUBSCRIPTION,MCOSTANDARD,SHAREPOINTWAC,SHAREPOINTENTERPRISE

The next step is to assign remove the Office Pro Plus subscription and assign Exchange Online

Import-Csv .\Sample.CSV | ForEach {Set-MsolUserLicense -UserPrincipalName $_.UPN -LicenseOptions $Step2}

Again using (Get-MSOLUser –UserPrincipalName “Your UPN”).Licenses[0].ServiceStatus you can see that the change to the subscription was successful:

If you try to modify the subscription using the same commands used for first time license allocation, you will get an error stating that the license is invalid

Deploying Office 365 Desktop Updates

When migrating to Office 365 it is necessary to distribute updates to your client machines which will facilitate authentication with the Office 365 service along with adding features and support for the Office 365 services into the Office suite on your desktop.

There are a couple of ways these updates can be distributed to the client machines: –

Centralised Deployment

Many businesses will have an SOE and a managed environment in which the most effective method of distribution will be using a patch management system such as Microsoft System Centre Configuration Manager.

This approach will give you access to scheduling, delivery and reporting tools that will help ensure successful deployment of the updates along with minimising the need to manually install them on individual machines.

All systems will require the Microsoft Online Services Sign-In Assistant – x86 or x64

Depending on the OS and version of Office, there are different updates required. If your Office updates are current, it is likely that these updates will already be installed.

Office 2007 on Windows XP SP3 or Windows 7 requires two updates:

Office 2010 on Windows XP SP3 or Windows 7 requires the following three updates:

  • Microsoft Office 2010 Update* – x86 or x64
  • Microsoft Outlook 2010 Update – x86 or x64
  • Microsoft OneNote 2010 Update – x86 or x64

*On Windows XP after applying this update the following reg key is required for each user [HKCU\Software\Microsoft\Office\14.0\Common\Internet\FormsBasedAuthSettings\AllowFBANoPatches – DWORD: 1]

The patches I’ve described can be downloaded from community.office365.com.

Self Service

The other method is by using the Microsoft Office 365 desktop setup tool which is a user self service option. This is the best option for unmanaged environments such as employees configuring their home PCs for use with the Office 365 service and depending on the migration method, it may also be the most hassle free way to configure your desktop applications such as Outlook, Lync, and integrate with SharePoint Online. Local admin rights to allow software installation is a requirement however.

Running the service connector application will scan your system and work out which updates (and/or registry keys) are required by your system in order to use the Office 365 service with your OS and version of Office.

Depending on what services have been assigned to your account in the portal it will also work out what applications it can automatically configure for you.

The service connector can be downloaded from here but you will need an active Office 365 account.

Follow

Get every new post delivered to your Inbox.