Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBscript running command on remote computer

Status
Not open for further replies.

stupman

Technical User
Apr 11, 2003
77
BE
Hi there,

I want to write a script that is able to execute a command on a remote computer.
Any ideas howto do this??

Any input is veryvery welcome!!

Grtz, Rein.
 
Useful, but not applicable to my case. I want to run a script as scheduled task, that runs some commands on remote computers.
I was thinking in the direction of the Create method in the WMI WIN32_Process class. Do you have any experience with that?
 
I think I follow what you're trying to do. I have a script that runs on my machine and allows me to execute scripts remotely. I don't see a reason why you wouldn't be able to schedule it.

Code:
RemotePC = "<PC Name>"
RemoteScript = "<Path to local script>"
Dim Controller, RemoteScript
Set Controller = wScript.CreateObject("WSHController")
Set RemoteScript = Controller.createscript(RemoteScript, RemotePC)
WScript.ConnectObject RemoteScript, "remote_"
RemoteScript.Execute

do while RemoteScript.Status <> 2
   WScript.Sleep 100
loop

If you're attempting to run scripts on remote XP machines you'll have to do two things on each remote machine, 1) run "wscript -regserver", 2) In HKLM\Software\Microsoft\WindowsScriptHost\Settings set, or create, Remote string value to 1.

-If it ain't broke, break it and make it better.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top