Skip to content

Instantly share code, notes, and snippets.

@gabemarshall
Created January 3, 2018 15:30
Show Gist options
  • Save gabemarshall/a708aad5b70a31d0bec19b86a1b73c28 to your computer and use it in GitHub Desktop.
Save gabemarshall/a708aad5b70a31d0bec19b86a1b73c28 to your computer and use it in GitHub Desktop.
Executing JScript from Powershell via .NET reflection
[Reflection.Assembly]::LoadWithPartialName('Microsoft.JScript');
$js = 'var js = new ActiveXObject("WScript.Shell");js.Run("calc");'
[Microsoft.JScript.Eval]::JScriptEvaluate($js,[Microsoft.JScript.Vsa.VsaEngine]::CreateEngine());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment