Quantcast
Channel: VBForums - ASP, VB Script
Viewing all articles
Browse latest Browse all 688

psexec in vbscript works fine, except when initiated by drag and drop

$
0
0
I have a vbscript - lets call it "masterscript" that includes a psexec call, something like this:

%comspec% /c psexec.exe -accepteula \\targethostname -u targethostname\username -p password %comspec% /c "cscript \\scriptpath\slavescript.vbs arga argb"


The above command (interpreted for clarity) is put into a variable "cmd", and then called like this:
result = objShell.Run(cmd, 0, FALSE)


Scenario 1:

The above psexec line works perfectly, when I double-click on "masterscript", to run it. In this scenario, I have a popup selection in the middle of masterscript, to choose the text file that contains the variable data I want to use.

Scenario 2:

Then I decided I wanted to instead drag and drop the variable data text file onto "masterscript", in order to initiate the whole execution. Everything appears to work fine with this scheme, except, the above psexec command never actually executes.

If I add "msgbox result" after the result line, it returns "0" in Scenario 1, when I double click masterscript to execute (the scenario where it works). But the result also returns "0" when it doesn't work in Scenario 2, when I drag and drop the variable file onto masterscript, in order to execute.

So I'm guessing, there's some sort of security/permissions issue executing psexec lines, when the script containing them isn't directly initiated (ie. via double-click).

Any ideas how I can get more concrete evidence of what is occurring (I get no errors; it just doesn't issue the psexec command), or how I can get around this?

Viewing all articles
Browse latest Browse all 688

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>