Created
July 19, 2016 16:59
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[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