We help IT Professionals succeed at work.

Check out our new AWS podcast with Certified Expert, Phil Phillips! Listen to "How to Execute a Seamless AWS Migration" on EE or on your favorite podcast platform. Listen Now

x

PSEXEC "How To"

Medium Priority
1,307 Views
Last Modified: 2012-05-11
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?
Comment
Watch Question

Paul MacDonaldDirector, Information Systems
CERTIFIED EXPERT

Commented:
What happens if you run the vbs file on the machine itself (rather than running it remotely)?

Author

Commented:
It works fine if I run it on the machine itself....

Author

Commented:
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?
Information Services Manager
CERTIFIED EXPERT
Commented:
Unlock this solution with a free trial preview.
(No credit card required)
Get Preview
Ron MalmsteadInformation Services Manager
CERTIFIED EXPERT

Commented:
or,


"cmd /c c:\windows\system32\wscript.exe c:\www.vbs"

Author

Commented:
I get:
"cmd exited on REMOTEMACHINE with error code 0"

BUT nothing still happens on the remote machine!

Author

Commented:
yes, the file is located on the root of C

Author

Commented:
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?

Author

Commented:
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
Ron MalmsteadInformation Services Manager
CERTIFIED EXPERT

Commented:
..can we see the contents of your script ?
Ron MalmsteadInformation Services Manager
CERTIFIED EXPERT

Commented:
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.

Ron MalmsteadInformation Services Manager
CERTIFIED EXPERT

Commented:
It must be something in the script that is not working properly.
Please post the contents of the VBS script.

Author

Commented:
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

Author

Commented:
still not working. i give up.
Top Expert 2011

Commented:
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.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a free trial preview!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.