Checking for Available Licences in Office365 via Powershell

You should have the sign-in assistant and the Azure AD Module for Powershell already installed and be connected (connect-msolservice).

You’ll need to know what SKU you’re looking to check

Get-MsolAccountSku

I’ll be working with  E1’s, and will throw it into a variable:

$accountsku = “megacorpinc:EXCHANGESTANDARD”

Once we have that, we’re ready to pull active and consumed units:

$activeunits = (Get-MsolAccountSku | where {$_.AccountSkuId -eq $accountsku}).ActiveUnits

$consumedunits = (Get-MsolAccountSku | where {$_.AccountSkuId -eq $accountsku}).ConsumedUnits

Then take the difference…

$availableunits = $activeunits – $consumedunits

And there you have it.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s