1

Is it possible to execute a remote executable using a .vbs script? My below attempt doesn't seem to work (sadly).

Dim objShell
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("""\\12.345.67.789\filename.exe""")
Set objShell = Nothing
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
Sean
  • 11
  • 1
  • this seems like a horrifying security issue if vbs could do that – Marker May 16 '18 at 17:16
  • something to check out: https://stackoverflow.com/questions/26926114/how-to-download-exe-file-from-web-and-run-it-with-some-script – Marker May 16 '18 at 17:19
  • @Marker your usage of _if_ is a little ambiguous to me. it's definitely not possible then? – Sean May 16 '18 at 17:20
  • I am having hard to understand your `\\12.345.67.789\filename.exe`. Do you want to run the executable on the remote machine, or download the executable located on a shared drive of another machine and execute it locally ? If 1 you should look into [this](https://helloacm.com/vbscript-function-to-run-program-at-remote-computer/). If 2 fix your shared drive address, or copy the file and run it... – Thomas G May 16 '18 at 18:08
  • @ThomasG Hey, thanks for the comment. I'm trying to download the exe from a remote VPS and execute it locally, preferably using only one or two lines of code. What did you mean "fix your shared drive address"? How is it broken? – Sean May 16 '18 at 19:00
  • Try to use `Shell.Application`. – omegastripes May 16 '18 at 20:24
  • 1
    The path in your code snippet is not a valid UNC path (`\\server\share\filename.exe`). In general it should be possible to run a file like that from a remote SMB share that your account has access to on your local computer. You may need to add the share as a trusted location, though. Running an executable directly from a *web* location like that is not possible. You need to download and save it first. – Ansgar Wiechers May 16 '18 at 20:56
  • @sean just what Ansgar explained above – Thomas G May 17 '18 at 06:36

0 Answers0