Created
July 23, 2019 23:30
-
-
Save steviecoaster/398544abfd1e6834888258e283d292fe to your computer and use it in GitHub Desktop.
Query size of a chocolatey log
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
function Get-ChocoLogSize { | |
<# | |
.SYNOPSIS | |
Returns the size of the chocolatey.log file in MB | |
.PARAMETER Computername | |
The system to query. Defaults to the local COMPUTERNAME | |
.EXAMPLE | |
Get-ChocoLogSize | |
.EXAMPLE | |
Get-ChocoLogSize -Computername Wrkstn02 | |
#> | |
[cmdletBinding()] | |
param( | |
[Parameter(ValueFromPipeline,ValueFromPipelineByPropertyName)] | |
[String[]] | |
$Computername = $env:COMPUTERNAME | |
) | |
$params = @{ | |
Computername = $Computername | |
Scriptblock = { [Math]::Round(((Get-ChildItem "$env:ChocolateyInstall\logs\chocolatey.log").Length /1MB),2) } | |
} | |
Invoke-Command @params | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment