Created
August 24, 2018 01:48
-
-
Save jfrantz1-r7/bfa2a73dd257409e52786c8f7372efaa to your computer and use it in GitHub Desktop.
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 Enable-PSScriptBlockLogging | |
{ | |
$basePath = “HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging” | |
if(-not (Test-Path $basePath)) | |
{ | |
$null = New-Item $basePath -Force | |
} | |
Set-ItemProperty $basePath -Name EnableScriptBlockLogging -Value “1” | |
} | |
function Disable-PSScriptBlockLogging | |
{ | |
Remove-Item HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging -Force -Recurse | |
} | |
function Enable-PSScriptBlockInvocationLogging | |
{ | |
$basePath = “HKLM:\Software\Policies\Microsoft\Windows\PowerShell\ScriptBlockLogging” | |
if(-not (Test-Path $basePath)) | |
{ | |
$null = New-Item $basePath -Force | |
} | |
Set-ItemProperty $basePath -Name EnableScriptBlockInvocationLogging -Value “1” | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment