Finding mis-licensed shared users in Office 365

Finding mis-licensed shared users in Office 365

  •  
  •  
  •  
  •  
  •  
  •  

Just a quickie post this holiday week.

Many customers have had Exchange on-premises forever.  Back in the olden days, we just had user mailboxes.  Need a shared team mailbox? You get a user mailbox.  Need a conference room mailbox?  You get a user mailbox.

You get the idea.

Throughout the course of time, we created a bunch of different types of mailboxes for different purposes.  Nowadays, you can create a normal user mailbox, you can create a conference room mailbox that has some specialized calendar processing associated with it, you can create an equipment mailbox for somethink like a laptop or VCR–err, “media player” that can be checked out, or you can create a shared mailbox that bunch of people can …  share.

One of the things I discovered from my time in Microsoft Consulting Services is that many organizations who have continued to migrate or upgrade Exchange along the way from the olden days might not have configured their mailbox recipient types correctly, so they end up with hundreds or thousands of mailboxes that are used as shared or conference room mailboxes, but configured like normal user mailboxes.  In the world of Office 365 where every user mailbox has to be licensed (but shared and resource mailboxes don’t), this is no bueno.

So, let’s say you’ve migrated to Office 365, licensed all the mailboxes, and then went back through and were trying to figure out how to determine what mailboxes are licensed that didn’t need to be anymore.

You can.  Through the wonder of PowerShell, this magic one-liner will show you everything you need (you’ll need to have connected to both the Microsoft Online service as well as the Exchange Online remote PowerShell):

Get-Mailbox -ResultSize Unlimited -Filter '{(RecipientTypeDetails -ne "UserMailbox") -and (RecipientTypeDetails -ne "DiscoveryMailbox")}' | Get-MsolUser |? {$_.isLicensed -eq $True }

There are some caveats for mailbox size, such as you need a mailbox license for a shared or resource mailbox if it’s over 50GB (or if you have a retention policy applied to it).

This is a little more complex, but this example will show you shared and resource mailboxes that are licensed and are over 49GB (which indicates you’ll likely need a license to continue using it):

[array]$Results = @()
[array]$Temp = Get-Mailbox -ResultSize Unlimited -Filter '{(RecipientTypeDetails -ne "UserMailbox") -and (RecipientTypeDetails -ne "DiscoveryMailbox")}' | Get-MsolUser | ? { $_.isLicensed -eq $True }
Foreach ($obj in $Temp)
{
 $Results += (Get-MailboxStatistics $obj.UserPrincipalName | Select DisplayName, @{ N = "GBSize"; E = { [math]::Round((($_.TotalItemSize.Value.ToString()).Split("(")[1].Split(" ")[0].Replace(",", "")/1GB), 2) } }, ItemCount | ? { $_.GBSize -gt 49 })
}
$Results

Happy license reclamation day!

Published by Aaron Guilmette

Helping companies conquer inferior technology since 1997. I spend my time developing and implementing technology solutions so people can spend less time with technology. Specialties: Active Directory and Exchange consulting and deployment, Virtualization, Disaster Recovery, Office 365, datacenter migration/consolidation, cheese.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.