jermdw
12/9/2017 - 12:02 AM

Bypass Execution Policy No Matter What!

Bypass Execution Policy No Matter What!

# Reference - http://community.idera.com/powershell/powertips/b/tips/posts/allowing-powershell-script-execution---no-matter-what

$context = $executioncontext.gettype().getfield('_context','nonpublic,instance').getvalue($executioncontext); $field = $context.gettype().getfield('_authorizationManager','nonpublic,instance'); $field.setvalue($context,(New-Object management.automation.authorizationmanager 'Microsoft.PowerShell'))