Connect to Exchange Online PowerShell
Exchange Online PowerShell Modunle
You need install Exchange Online module only once. In the next time, run to connect to Exchange Online PowerShell.
##Connect to Exchange Online Powershell.
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine -Force;
Install-PackageProvider -Name NuGet -Force;
Set-PSRepository -Name "PSGallery" -InstallationPolicy Trusted;
Install-Module -Name ExchangeOnlineManagement;
Import-Module ExchangeOnlineManagement;
Connect-ExchangeOnline;
Get all shared mailboxes and sort them by size in GB
##Get all shared mailboxes and sort them by size in GB.
Get-ExoMailbox -RecipientTypeDetails SharedMailbox |
Get-MailboxStatistics |
Select-Object DisplayName, @{name=”TotalItemSize (GB)”;expression={[math]::Round((($_.TotalItemSize.Value.ToString()).Split(“(“)[1].Split(” “)[0].Replace(“,”,””)/1GB),2)}},ItemCount |
Sort “TotalItemSize (GB)” -Descending | Out-GridView
Get all shared mailboxes then export to a CSV file
##Get all shared mailboxes and sort them by size in GB.
New-Item -Path "$env:temp" -Name "O365" -ItemType "directory" -Force
$CurrentDate = Get-Date
$CurrentDate = $CurrentDate.ToString('MM-dd-yyyy_hh-mm-ss')
Get-ExoMailbox -RecipientTypeDetails SharedMailbox |
Get-MailboxStatistics |
Select-Object DisplayName, @{name=”TotalItemSize (GB)”;expression={[math]::Round((($_.TotalItemSize.Value.ToString()).Split(“(“)[1].Split(” “)[0].Replace(“,”,””)/1GB),2)}},ItemCount |
Sort “TotalItemSize (GB)” -Descending |
Export-CSV $env:temp\o365\Office365-ShareMailboxSize-Report_$CurrentDate.csv -NoTypeInformation -Encoding UTF8; ii $env:temp\o365;
5/5 - (1 vote)