Link to home
Start Free TrialLog in
Avatar of wantabe2
wantabe2Flag for United States of America

asked on

PSEXEC "How To"

I'm trying to run a file named www.vbs on a remote computer on my LAN with PSEXEC but it is not working... When I execute the cmd:

psexec \\remotecomputer "c:\www.vbs"

I get:

exited on remotecomputer with error code 1

But nothing is happenign on the remote computer...any ideas?
Avatar of Paul MacDonald
Paul MacDonald
Flag of United States of America image

What happens if you run the vbs file on the machine itself (rather than running it remotely)?
Avatar of wantabe2

ASKER

It works fine if I run it on the machine itself....
I've even tried running:

psexec.exe -u domain\administrator -p the password \\remotemachine c:\2.bat

and I get an error code of 0 but nothing happens on the remote machine
This file is on the remote machines C Drive?
ASKER CERTIFIED SOLUTION
Avatar of Ron Malmstead
Ron Malmstead
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
or,


"cmd /c c:\windows\system32\wscript.exe c:\www.vbs"
I get:
"cmd exited on REMOTEMACHINE with error code 0"

BUT nothing still happens on the remote machine!
yes, the file is located on the root of C
I can even try to run the basic:

psexec \\RemoteComputer cmd.exe

& it just sits there & does nothing on my machine........can anyone help me?
Let me re-phrase that, after I run the above cmd, it takes me to a c:\windows\system32 prompt on my workstation & does nothing on the remote computer
..can we see the contents of your script ?
psexec \\RemoteComputer cmd.exe

...is just going to sit there and do nothing, because you haven't given CMD a command to run.


Now if you did...

psexec \\RemoteComputer "cmd.exe /c batchfile.bat"

That will run the batch file....
Provided you bat file actually does something and is a functional working script...it should do whatever you made it to do.

It must be something in the script that is not working properly.
Please post the contents of the VBS script.
I just noiceed something, if I execute the .vbs script locally I have to click the "open" button to get it to run.....can I automate me clicking the "open" button on the remote machine with psexec or is this something that has to be done within the .vbs file? I've pated my .vbs code



Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run("%comspec% /K c:\2.bat"), 1, True

Open in new window

still not working. i give up.
I see this is closed already, but you can get this to run using PSExec on a batch file on the remote computer to execute the VBS file, also on the remote computer. So this means, both the batch and VBS file need to be on the remote computer, and the batch file calls the VBS file into action accordingly.