Get-SBLLogSize.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
function Get-SBLLogSize
{
    <#
        .SYNOPSIS
        Reports the current script block log size.
 
        .DESCRIPTION
        Returns the current size of the script block log.
 
        .EXAMPLE
        Get-SBLLogSize
        Returns the current size of the script block log.
    #>



  $Path = "Registry::HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WINEVT\Channels\Microsoft-Windows-PowerShell/Operational"
  $Key = Get-ItemProperty -Path $Path
  [PSCustomObject]@{
    Enabled = $key.Enabled -eq 1
    MaxSize = $key.MaxSize
    MaxSizeMB = '{0:n1} MB' -f ($key.MaxSize / 1MB)
  }
}