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?
LVL 15
wantabe2Asked:
Who is Participating?
 
Ron MalmsteadConnect With a Mentor Information Services ManagerCommented:
Try this...

"cmd /c  c:\2.bat"
0
 
Paul MacDonaldDirector, Information SystemsCommented:
What happens if you run the vbs file on the machine itself (rather than running it remotely)?
0
 
wantabe2Author Commented:
It works fine if I run it on the machine itself....
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
wantabe2Author 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
0
 
athomsfereCommented:
This file is on the remote machines C Drive?
0
 
Ron MalmsteadInformation Services ManagerCommented:
or,


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

BUT nothing still happens on the remote machine!
0
 
wantabe2Author Commented:
yes, the file is located on the root of C
0
 
wantabe2Author 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?
0
 
wantabe2Author 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
0
 
Ron MalmsteadInformation Services ManagerCommented:
..can we see the contents of your script ?
0
 
Ron MalmsteadInformation Services ManagerCommented:
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.

0
 
Ron MalmsteadInformation Services ManagerCommented:
It must be something in the script that is not working properly.
Please post the contents of the VBS script.
0
 
wantabe2Author 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

0
 
wantabe2Author Commented:
still not working. i give up.
0
 
Brian GeeCommented:
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.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.