Results 1 to 13 of 13

Thread: Running script on remote machine

  1. #1
    SuderMan Guest

    Running script on remote machine

    Hello !

    I have a script that I would like to run on several remote machines.
    I've tried several solutions but none of them is really working.
    Tools like psexec are not always working correctly.

    The best solution would the VBScript so in fact I need a script to run other
    script on several machines in a W2k domain.

    I've tried one like this:

    strRemoteComputer = "machine_name"
    strWorkerScript = "script_name.vbs"
    Set objWshController = WScript.CreateObject("WshController")
    Set objRemoteScript = objWshController.CreateScript(strWorkerScript,
    strRemoteComputer)
    objRemoteScript.Execute

    but i'm getting error: ActiveX component can't create object


    Did You ever see a script that is really working on remote machines ?

    Thank You.

  2. #2
    NerdBoy Guest

    RE: Running script on remote machine

    You already know this and not have mentioned it, but:

    In order to use the WshController Object, you must enable it on each remote
    machine you plan to run the script on. You enable it with the following
    script (Copied from "MS Windows 2000 Scripting Guide" by MS Press)

    Const HKEY_LOCAL_MACHINE = &H80000002
    strComputer = "RemoteCompName"

    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"

  3. #3
    SuderMan Guest

    RE: Running script on remote machine

    thanks for your answer.
    I've changed the value in registry and script is running without error but
    nothing happens, there is no effect on remote computer.

    Any idea what's wrong ?

  4. #4
    SuderMan Guest
    In addition I can say that on remote machine's event log I can see that:
    "Succesful remote execution of windows script host"
    but that's all, there is no effect of script execution.

    You cannot perform any GUI tasks. try writing to a file on the remote
    machine. this will ensure that the script runs on the remote system.

    could You provide me please more details about this ?

  5. #5
    NerdBoy Guest

    RE: Running script on remote machine

    Is the snippet you supplied below a copy of what's really in your script? If
    that's the case, then a few thoughts:

    1. Maybe you need to specify the full path of the script you want to run on
    the other system.

    2. Also, a system has to be configured properly to be able to run a .vbs
    file just like a .exe/.bat/etc. I.e. I think that ".vbs" needs to be in the
    System Env "PATHEXT". And there might be other stuff you have to do.

    Maybe change your strWorkerScript to:

    strWorkScript = "cscript C:\path\to\script\script_name.vbs"

    Hope that helps!

  6. #6
    bournejason Guest

    Re: Running script on remote machine

    To enable Remote scripting, you'll need to enable remote scripting
    execution on the remote machine. this can be done by editing the
    registry,
    HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows Script Host\Settings

    Add REG_SZ named: Remote
    Set value to 1

    http://msdn.microsoft.com/library/de...35370fae5b.asp


    Now create the script with some file IO. This will allow you to confirm
    the execution of the script.


  7. #7
    SuderMan Guest

    Re: Running script on remote machine

    Yes I know this very well, the problem is that account and password need to
    be passed to make the script working.

    i.e. script mapping drive will not work remotely unless You specify valid
    username and password.

    "Now create the script with some file IO." - Do you mean by that creating a
    file on remote machine ?

  8. #8
    bournejason Guest
    Yes create some file on the remote machine using the scirpt and write
    to the file.

    but then I have to execute it remotely.

    Do it the same way as before or using other method ?

    yes the same way.

  9. #9
    SuderMan Guest

    Re: Running script on remote machine

    Ok but in fact it's the same if I copy the script to the remote machine and
    execute it from it's local drive like that:

    Set objRemoteScript =
    objWshController.CreateScript("\\remote_machine\c$\temp\MyScript.vbs",
    Remotemachine)

    isn't it ?

  10. #10
    bournejason Guest
    you can run the script from some other machine as well. it does not
    have to be the remote machine.

    i am e-mailing you a short pdf abt this at
    SuderMan@discussions.microsoft.com

    if the above is not ur e-mail let me know.

    ok that's interesting.

    let me know if it was helpful

  11. #11
    Rakesh Gupta Guest

    RE: Running script on remote machine

    I am also running into issues when trying to run a script remotely. I keep
    getting the "Catastrophic Failure" error on CreateScript call. I have enabled
    the remote scripting by following the steps mentioned in the following URL

    http://msdn.microsoft.com/library/de...c755690065.asp

    and I am trying to execute the following test script

    http://msdn.microsoft.com/library/de...9c8d5865dd.asp

    Any ideas of what I might be doing wrong. The same issue is happening on
    both W2k & XP.

  12. #12
    Rakesh Gupta Guest

    RE: Running script on remote machine

    Just to clarify:
    I have verified all the steps listed under "Setting up Remote WSH" in MSDN
    namely:
    1) verifying WSH version being 5.6
    2) Making sure the account used to execute the script is an admin on the
    remote machine,
    3) setting HKLM\Software\Microsoft\Windows Script Host\Settings\Remote to 1.

  13. #13
    Join Date
    Aug 2010
    Posts
    1

    Re: Running script on remote machine

    Hi my name is abhijeet,my query is
    I have a windows 2003 server which is configured as a DNS server. I am using squid proxy for internet access by workstations on my network.I have created a manual entry in the dns wherein in the workstation's IE browser proxy settings I have entered the name of the proxy server and the port no instead of the ip address of the DNS server. I want to know how to make a batch file or a script file through which I can do these settings on multiple workstations at one go other that me having to individually having to do these settings in the browser.

Similar Threads

  1. Running a batch file from a remote machine in a VB code
    By Radhu in forum Software Development
    Replies: 1
    Last Post: 14-10-2011, 04:54 PM
  2. Running an MSI file on a remote machine
    By brock_griffin@hotmail.com in forum Windows Server Help
    Replies: 6
    Last Post: 09-07-2010, 04:36 AM
  3. Script to add a machine to domain
    By martinez7251 in forum Windows Software
    Replies: 1
    Last Post: 11-05-2010, 11:23 PM
  4. Script execution machine available by mail
    By HardWeaR in forum Software Development
    Replies: 3
    Last Post: 11-12-2009, 02:01 PM
  5. Check if process is running on Local Machine using VB script
    By Aspen in forum Software Development
    Replies: 3
    Last Post: 03-09-2009, 09:46 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,713,445,504.64342 seconds with 17 queries