Link to home
Start Free TrialLog in
Avatar of BLACK THANOS
BLACK THANOSFlag for United States of America

asked on

Execute script remotely

I am trying  to run the following snippet:
I get this error:
ActiveX component can't create object

it is suppose to echo the word hello on the remote machine
*************************************************************
strRemoteComputer = "HIT1W015-1"
strWorkerScript = "\\Homedir\dfsroot\NETOPS DOCS\VBS\HELLO.VBS"

Set objWshController = WScript.CreateObject("WshController")
Set objRemoteScript = _
    objWshController.CreateScript(strWorkerScript, strRemoteComputer)
objRemoteScript.Execute
*************************************************************
Avatar of EDDYKT
EDDYKT
Flag of Canada image

Avatar of joefm1218
joefm1218

A couple of things to look out for here:

1) If the machine is set to your local machine, does the script work? I would try, if possible, to run the script locally first. If it doesn't work locally, then there might be a binary dependency inside your script that is not registered on the local machine (and also, the remote machine).

2) If it works locally, then you should check the following on the remote machine:
   a) Make sure the wscript object is registered properly using: C:\> wscript -regserver
   b) Another possibility is that you haven't enabled the WshController object, which is disabled by default. To enable this object, you must add a value entry to the HKEY_LOCAL_ MACHINE\SOFTWARE\Microsoft\Windows Script Host\Settings registry subkey on the target computer. Open this subkey and click New, String Value on the Edit menu. Enter the value name Remote and a data value of 1. You don't need to restart the target computer for the new setting to take effect

Performing (a) and (b) will ensure that the scripting object is properly enabled on the remote machine.
Avatar of BLACK THANOS

ASKER

You guys are on the right track:

1. I made sure that I made the necessary changes on the remote and local machine to reflect the registry changes.
2. I am running windows xp sp1 on the source machine
3. The target machine is alsow xp sp1
4. the code snippet doesnt work on the local machine either.
5. I ran the wscript -regserver on the local machine and recieved the error : access is denied
6. I am a member of the local administrators group.

Were getting there guys. since there has been more than one response I am willing to split points depending on solution.
thx guys
I have been out of commission for a few weeks because of illness, but I would still like to continue with my problem. No one has answered my response from 09/30/04
Dan ,

I left an email with you to go ahead and delete the above action item, as there was no solution. I dont know how to delete it myself
ASKER CERTIFIED SOLUTION
Avatar of David Lee
David Lee
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
PAQed with points refunded (500)

modulo
Community Support Moderator
Hey BlueDevilFan,

You are the man. You resolved my issue. I want to give you the 500 points, but the question was already closed because their had been no response to my problem for quite sometime. Please instruct me on how to re-open the case and award you the 500 points. Once again you are the man Blue Devil.
Glad I could help.  I'm not certain about how to reopen the question.  One possibility is to post a message in the community support forum (https://www.experts-exchange.com/Community_Support/) explaining the situation and asking to have the question reopened.  Explain that you'd asked for the question to be left open but it was closed anyway.  Include the question number in your post.  If that doesn't work, then you can always open another question on the same topic with a link to this question.

-- BlueDevilFan