Jan 9, 2013

Check mailbox size and usage with Office 365 or Exchange online. Find users nearing their quota.

The other day I wanted to have a look at the mailbox usage for one of my Office 365 clients.  I wanted to see all 35 users and find out if anyone was close to their mailbox quotas.  There is no way to check this for all users at once using the Office 365 or Exchange Online GUI so you need to turn to PowerShell.  I had to go to 5 or 6 different sites to find all of the little details and troubleshoot some errors so I thought I'd compile all of that info into a blog post for you.

  1. First of all, you need to use the regular version of PowerShell.  NOT the "Online Services Module" for PowerShell version that you would typically use for other Office 365 tasks, I guess because we are talking directly to the Exchange environment here and not the Office 365 portal itself. 
  2. Make sure you run PowerShell as an administrator. (Right-click the icon and select "Run as Administrator")
  3. The first time I ever tried to run these type of scripts, I got an error about running remote signed scripts or something like that. So you need to run this command the very first time you try any operations like this:  
    • Set-ExecutionPolicy RemoteSigned
  4. Next are the 3 commands that you need to run to connect to your hosted Exchange server and start a new session:
    • $LiveCred = Get-Credential (then enter your Office 365 email address and password in the box that pops up)
    • $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://ps.outlook.com/powershell/ -Credential $LiveCred -Authentication Basic –AllowRedirection
    • Import-PSSession $Session
  5. Next is the basic command to get a list of all users and their current mailbox size:
    • get-mailbox | get-mailboxstatistics | ft displayname, totalitemsize
  6. When you are finished, it's a best practice to go ahead and close your session before you exit PowerShell, so you need to run this command:
    • Remove-PSSession $Session
These steps should get you connected and give you a quick look at user mailbox sizes so you can see if anyone is in danger of hitting their quota.  There are a ton of other scripts that can give you all sorts of information about the hosted Exchange environment.  I even some scripts that would actually create a local Excel spreadsheet and pipe the output to that file so you could save it or analyze it further. I'll try to post more of this type of stuff in the future.

Autopilot White Glove error message We couldn't find any Provisioning Packages

I was testing out the Windows Autopilot "White Glove" feature this week.  This is a new feature of the Intune AutoPilot service th...