发布新日志

  • Remote Scripts

    2008-10-07 16:50:14

    Run scrīpts remotely

     

    WSH 5.6 can run scrīpts that reside on remote systems. The following scrīpts demonstrate this capability. These scrīpts make the assumption that the files are located on a local machine directory called "c:\wsh5.6"; change the local path and the remote machine name as necessary.

    After initially running RemoteTest.WSF on the local machine, there may be a small pause as DCOM verifies your identity. After you see the "Done" message, a file named "c:\beenhere.txt" on the remote machine indicates the time that you executed the command (from the remote computer's clock).

     

    ' VBscrīpt.

    RemoteTest.WSF

    -------------------------------

    <package>

    <job>

    <scrīpt language="VBscrīpt">

    set ōController = CreateObject("WSHController")

    set ōProcess = oController.Createscrīpt("c:\wsh5.6\beenhere.wsf", "remmachine")

    oProcess.Execute

    While oProcess.Status <> 2

       Wscrīpt.Sleep 100

    WEnd

    Wscrīpt.Echo "Done"

    </scrīpt>

    </job>

    </package>

    -------------------------------

     

    BeenHere.WSF

    -------------------------------

    <package>

    <job>

    <scrīpt language="VBscrīpt">

    set fso = CreateObject("scrīpting.FileSystemObject")

    set fout = fso.CreateTextFile("c:\beenhere.txt", true)

    fout.WriteLine Now

    fout.Close

    </scrīpt>

    </job>

    </package>

     

     

     

     

    Setting up Remote WSH

     

    Remote WSH, which is a new technology included in WSH 5.6, provides the ability to run a scrīpt on a remote machine or machines. With Remote WSH, the scrīpt is physically copied from the local machine to the remote machine before executing. In order to enable Remote WSH functionality, you must first set up the remote machine with the proper security settings. The steps below perform the tasks that enable Remote WSH.

    Note   Both the remote and local machines must be running Windows NT 4 SP3 or greater in order to use Remote WSH.

    To enable a machine to run remote scrīpts

    1. Install WSH V5.6 on the machine. If you are using Windows 2001 or have installed Internet Explorer 6 or greater, WSH 5.6 has already been installed.
    2. Add yourself to the remote machine's Local Administrators group.
    3. WSH should now be enabled on the machine.

     

     

     

    Problems you may encounter

     

    Problem 1 : Permission denied

      

    Solutions :

     

    1. The local and remote machines must be connected. They should belong to the same domin.
    2. For the Createscrīpt function does not have interfaces of log on user and password. User have to log on the local and remote machine with both qualified ID. For example, there is an administrater user ABC on the remote machine with specific qualification. User have to create a same user ABC on the local machine and logon the local machine with this user ID.

     

     

    Problem 2 : ActiveX component can’t create object

     

    Solutions :

     

    1. XP Pro shipped with a configuration bug in which WSH 5.6 fails to set up properly. The problem appears to be limited to the WshController object. To resolve the problem, you need to run the command : wscrīpt –regserver
    2. Another possibility is that you haven't enabled the WshController object, which is disabled by default. To enable this object, you may add a value entry to the HKEY_LOCAL_ MACHINE\SOFTWARE\Microsoft\Windows scrīpt 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.

     

     

    Problem 3 : DCOM configuaration

    Solutions :

     

    1. Click Start -> Run
    2. Enter DCOMCNFG and press OK. This will open the DCOMCNFG window.
    3. Browse down the tree to Console Root ' Component Services ' Computers ' My Computer
    4. Right click on "My Computer" and select properties
    5. Select the "Default Properties" tab
    6. Enable Distributed COM on this computer - option is checked. 
    7. Select the "COM Security" tab  
    8. Add the user to Edit Limits and give it full control authorities.
    9.  Reboot the computer.

    Note :  The DCOM configuration on  Windows XP and Windows 2000 is slightly different. But the main settings is quite the same.

我的栏目

我的存档

数据统计

  • 访问量: 798
  • 日志数: 1
  • 建立时间: 2008-10-07
  • 更新时间: 2008-10-07

RSS订阅

Open Toolbar