Solved

Execute script remotely

Posted on 2004-09-30
13
1,034 Views
Last Modified: 2008-01-09
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
*************************************************************
0
Comment
Question by:BLACK THANOS
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
  • 2
  • +2
13 Comments
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12193423
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12193442
0
 
LVL 3

Expert Comment

by:joefm1218
ID: 12193496
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.
0
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 

Author Comment

by:BLACK THANOS
ID: 12194934
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
0
 

Author Comment

by:BLACK THANOS
ID: 12311950
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
0
 

Author Comment

by:BLACK THANOS
ID: 12658662
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
0
 
LVL 76

Accepted Solution

by:
David Lee earned 500 total points
ID: 12661658
Regishyde,

I found your question interesting and subscribed to watch it.  On seeing the message you posted today I found some time to play around with this.  Following the instructions in the two links posted by Eddykt I was able to get the process to work in short order.  Initially I ran into two problems.  Here they are, along with what I did to resolve them.

1.  Initially I received the following error:  wshcontrol.vbs(6, 1) (null): Catastrophic failure
After trying a few things I realized that the command, wscript -regserver, from the fist of Eddykt's links needs to be run on the local machine, i.e. the one running the control script.  I don't know if it needs to be run on the remote machine too, although initially I thought that was the only place it needed to be run.  To be safe I'd recommend running it on both machines.

2.  The remote script has to be in a location that both the local and remote PCs can see.  The example code in that first article has the script on a drive local to the controller PC.  When I tried running the script as is it failed saying it couldn't find the script to be run.  As soon as I moved it to a server share that both machines have access to the whole process worked without a hitch.  

My test environment was two XP Pro PCs, both members of a Windows 2000 Active Directory domain.  

In summary then, here's what I did.

1.  I added the registry entry mentioned in both of the article links Eddykt provided to the remote PC.
2.  I ran the wscript -regserver command on both the local and remote PCs.
3.  I placed the remote script on a server share visible to both computers.
4.  I ran the controller script on the local machine.

You mention that the remote script doesn't run even on the local machine.  If that's correct, then I'd recommend resolving that issue first.  Once the script runs on the local machine, then try working on running it remotely.

I hope this helps.  
0
 

Expert Comment

by:modulo
ID: 12663818
PAQed with points refunded (500)

modulo
Community Support Moderator
0
 

Author Comment

by:BLACK THANOS
ID: 12666889
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.
0
 
LVL 76

Expert Comment

by:David Lee
ID: 12667207
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 (http://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
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
How to make an ADE file by code? 11 111
TT Auto Dashboard 13 104
Macro Excel - Multiple If conditions 2 94
Inserting a datasheet query into the body of an email using VBA? 4 79
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

752 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question