Skip to content

Instantly share code, notes, and snippets.

@KirillPashkov
Last active December 13, 2017 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KirillPashkov/2599e11476afa1086efde5de277b2497 to your computer and use it in GitHub Desktop.
Save KirillPashkov/2599e11476afa1086efde5de277b2497 to your computer and use it in GitHub Desktop.
Function InvokePS(Command)
cmd = "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -NoProfile -ExecutionPolicy Bypass -Command " & Command
Set shell = CreateObject("WScript.Shell")
Set executor = shell.Exec(cmd)
executor.StdIn.Close
InvokePS = executor.StdOut.ReadAll
End Function
Output = REPLACE(InvokePS(Command),vbCrLf,"")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment