Click to Rate and Give Feedback
MSDN
MSDN Library
Web Development
Scripting
Windows Script Host
WshRemote Object
Collapse All/Expand All Collapse All
This page is specific to
.NET Framework 3.0

Other versions are also available for the following:
 Collapse AllExpand All        Code: All Code: Multiple Code: Visual Basic Code: C# Code: Visual C++ Code: JScript 
WshRemote Object

Provides access to the remote script process.

Wsh Remote Object graphic

The WshRemote object allows you to remotely administer computer systems on a computer network. It represents an instance of a WSH script, that is, a script file with one of the following extensions: .wsh, .wsf, .js, .vbs, .jse, .vbe, and so on. An instance of a running script is a process. You can run the process either on the local machine or on a remote machine. If you do not provide a network path, it will run locally. When a WSHRemote object is created (by using the CreateScript() method), the script is copied to the target computer system. Once there, the script does not begin executing immediately; it begins executing only when the WSHRemote method Execute is invoked. Through the WshRemote object interface, your script can manipulate other programs or scripts. Additionally, external applications can also manipulate remote scripts. The WshRemote object works asynchronously over DCOM.

NoteNote:

In WSH version 5.6.6626, which ships with Internet Explorer 6 and Windows XP, a remote script is copied to memory in the remote machine and run from there. In later versions of WSH, such as the one provided by Windows Server 2003, a remote script is copied to the temporary directory of the account that accesses the remote machine. The script is run with the security settings for the remote machine and the temporary directory.

The following example demonstrates how the WshRemote object is used to start a remote script.

Code

VBScript
Dim Controller, RemoteScript
Set Controller = WScript.CreateObject("WSHController")
Set RemoteScript = Controller.CreateScript("test.js", "remoteserver")
RemoteScript.Execute

Do While RemoteScript.Status <> 2 
    WScript.Sleep 100
Loop
JScript
var Controller = WScript.CreateObject("WSHController");
var RemoteScript = Controller.CreateScript("test.js", "remoteserver");
RemoteScript.Execute();

while (RemoteScript.Status != 2) {
    WScript.Sleep(100);
}
Tags What's this?: Add a tag
Community Content   What is Community Content?
Add new content RSS  Annotations
Processing
© 2010 Microsoft Corporation. All rights reserved. Terms of Use | Trademarks | Privacy Statement
Page view tracker