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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Activate Executable On Remote Computer?

Status
Not open for further replies.

Sasstraliss

Programmer
Apr 7, 2009
21
AU
Is there a script that makes the specified remote computer run a specified .exe that is already on the target computer?

This is for our small network, we have our access protection program, but no way to activate it.

After having registry problems, we decided we wanted a script that does what I mentioned above.

Could someone help me with this?

Thanks in advance.
 
First make sure that the target PC is set to execute scripts remotely
Code:
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "RemoteComputerName"

Set objRegProv = GetObject("winmgmts:{impersonationLevel=Impersonate}" & _
 "!\\" & strComputer & "\root\default:StdRegProv")
 
strKeyPath = "SOFTWARE\Microsoft\Windows Script Host\Settings"
objRegProv.SetStringValue HKEY_LOCAL_MACHINE,strKeyPath,"Remote","1"

Then you can use the WSHController object.

Code:
Dim Controller, RemoteScript 
Set Controller = WScript.CreateObject("WSHController" ) 
Set RemoteScript = Controller.CreateScript(" script.vbs" , " RemoteSystem" ) 
WScript.ConnectObject RemoteScript, " remote_" 
RemoteScript.Execute 

Do While RemoteScript.Status <> 2 
WScript.Sleep 100 
Loop


I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top