Problem:
Doing Command Line work on Office 365. Side problem, getting statistics on on-line archive mailbox sizes.
Solution:
- Load up Powershell on your PC (it usually comes installed, you just have to search for it)
- Run as Administrator
- Set-ExecutionPolicy RemoteSigned (only run this one per computer)
- $UserCredential = Get-Credential
- Type in your credentials
- $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $UserCredential -Authentication Basic -AllowRedirection
- Import-PSSession $Session
- Check it by running get-mailbox and it should give you a result
- When you’re done, you must runĀ Remove-PSSession $Session otherwise you’ll have issues until the session times out
Checking the mailbox size of your accounts:
- get-mailbox | get-mailboxstatistics | ft displayname, totalitemsize
Checking the mailbox size of your online Archive:
- Get-Mailbox -Archive -ResultSize Unlimited | Get-MailboxStatistics -Archive | Sort-Object TotalItemSize -Descending | Select-Object DisplayName,TotalItemSize -First 100 (this pulls up the first 100, change it as you see fit)