$users = Get-Mailbox -ResultSize Unlimited -Filter {LitigationHoldEnabled -eq $true}
$colusers=@()
[string]$LogFile = “Path\filename-$(Get-Date -Format ‘dd_MM_yyyy HH_mm tt’).csv” # Path of the Log File
Add-Content $LogFile (“Mailbox” + “;” +” Item Count”);
$users | ForEach-Object {
Start-Sleep -Milliseconds 1000
$Identity = $_.WindowsEmailAddress
Write-host “working on:” $Identity
$colUsers = (Get-MailboxFolderStatistics -Identity $identity | where {$_.name -eq ‘Recoverable Items’}).FolderAndSubfolderSize.Split(‘(‘)[0]
Add-Content $LogFile ($Identity + “;”+ $colUsers );
}
Leave a comment