Get Mailbox Quota information from Exchange 2003

I wrote the script below to get all the mailbox quota information from all my users.  It loads the Quest ActiveRoles snappin if it doesn’t already exist, and created a .log file with all the data.  It is a |-separated file.

Write-Host “Checking ActiveRoles Snapin”
if (Add-PSSnapin Quest.ActiveRoles.ADManagement -ErrorAction silentlycontinue) {Write-Host “Added ActiveRoles Snapin”} Else {Write-Host “Snapin present.”}
Remove-Item “mbxquotas.log”
$logfile = New-Item “mbxquotas.log” -Type file
Add-Content $logfile “UserName|mDBStorageQuota|mDBOverQuotaLimit|mDBOverHardQuotaLimit|homeMDB”
$users = Get-QADUser -Sizelimit 0
$users | foreach
  {$user = get-qaduser $_
   $datastring = $user.name + “|” + $user.mdbstoragequota + “|” + $user.mdboverquotalimit + “|” + $user.mdboverhardquotalimit + “|” + $user.homemdb
   Add-Content $logfile -Value $datastring

Advertisements