Skip to content

Instantly share code, notes, and snippets.

@mgeeky
Forked from gabemarshall/jscript.ps1
Created October 12, 2024 19:35
Show Gist options
  • Save mgeeky/b8d1af37f978ed650de1cefa36e2983b to your computer and use it in GitHub Desktop.
Save mgeeky/b8d1af37f978ed650de1cefa36e2983b 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