This is a great proactive monitor because in most cases anyone who has over 50GB of OST files normally has an Outlook that runs like a snail or constantly crashes

"C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -command "& {$ErrorActionPreference = 'SilentlyContinue';$emptyOutput = \"\";[email protected]();$thresholdInGB = \"50\";dir c:\users | foreach -begin {} -process{$size=(dir $_.FullName *.ost -recurse -force -ea silentlycontinue | Measure-Object ‘length’ -sum -Maximum).sum;If (($size/1GB) -gt $thresholdInGB){$var1 = \"Error - OSTs Over $ThresholdInGB GB\"}else{$var1 = \"ProfileOK\"};If ($var1 -eq \"Error - OSTs Over $ThresholdInGB GB\"){$arrayresult += (\"{0:n2}\" -f ($size/1GB) +\" GB\",$_.fullname,$var1)}Else{};};$final = ($arrayresult) -join \"~\";if ($arrayresult){}Else{$Final = \"OST Sizes OK\"};Write-Output $final;}"

Remote Monitor Tips

  • For a Powershell remote monitor, any ” that is used inside the Powershell needs to be escaped with a backslash \
  • A Powershell remote monitor always needs to be one line. Break down multi-line scripts by ending each line with a semi-colon ;
  • Don’t configure remote monitors to run more frequently than needed. I run this once a week