#Connect to Exchange Online
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;
#Variables
mkdir $env:temp\o365; cd $env:temp\o365;
$OutputFile = "$env:temp\o365\Results.csv"
Get-Mailbox -Archive -ResultSize Unlimited |
Select-Object DisplayName, ArchiveStatus, UserPrincipalName, ArchiveQuota |
Export-Csv $OutputFile -NoTypeInformation -Encoding UTF8
#Clean up session
Get-PSSession | Remove-PSSession
ii $env:temp\o365; .\Results.csv
#End
5/5 - (1 vote)