Skip to content

Instantly share code, notes, and snippets.

@joegasper
Created July 19, 2016 16:59
Show Gist options
  • Save joegasper/64ba852cb6221bd0c764903e93ecf7e1 to your computer and use it in GitHub Desktop.
Save joegasper/64ba852cb6221bd0c764903e93ecf7e1 to your computer and use it in GitHub Desktop.
Exchange: Collect total storage size for .log files older than 30 days in standard logging path
[ScriptBlock]$cmd = {
$SizeGb = 0; Get-ChildItem -Path 'C:\Program Files\Microsoft\Exchange Server\V15\Logging' -Recurse -Filter '*.log' | ? {$_.LastWriteTime -lt (Get-Date).AddDays(-30)} | % {$SizeGb += $_.Length/1024/1024/1024}; Write-Output $SizeGb
}
#assumes your systems are named 'myexchbox01', 'myexchbox02', etc.
1..20 | % { $exmbx = 'myexchbox' + '{0:D2}' -f $_; $ServerGB = Invoke-Command -ComputerName $exmbx -ScriptBlock $cmd; Write-Output "$exmbx = $ServerGB" }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment