> > Interesting. I have
> > HKLM\SOFTWARE\Microsoft\Windows Script Host
> > HKLM\SOFTWARE\Microsoft\Windows Scripting Host
> > On my machine. I had WSH5.1 once, than 5.5, and now the 5.6 Beta.
> > > Yes, and you need to set HKLM\SOFTWARE\Microsoft\Windows Script
> > Host\Settings\Remote to 1 on the
> > > remote machine and AFAIK you must be in the remote machine's
> > Administrators group.
> > > --
> > > Michael Harris
> > > Microsoft.MVP.Scripting
> > > --
> > > Please do not email questions - post them to the newsgroup instead.
> > > --
> > > > You need WSH 5.6 on both machines to do this?
> > > > > It isn't an error - per the documentation, you can omit the 2nd
> > argument
> > > > (the remote machine name)
> > > > > and the script runs by default on the local machine. You would
> > normally
> > > > only do this while testing,
> > > > > especially during the beta where you may only have WSH 5.6 on
> > one
> > > > machine...
> > > > > --
> > > > > Michael Harris
> > > > > Microsoft.MVP.Scripting
> > > > > --
> > > > > Please do not email questions - post them to the newsgroup
> > instead.
> > > > > --
> > > > > > I think there is an error in the following line
> > > > > > var RemoteScript =
> > Controller.CreateScript("d:\\scripts\\myScript.js");
> > > > > > should be:
> > > > > > var RemoteScript =
> > Controller.CreateScript("d:\\scripts\\myScript.js",
> > > > > > "REMOTECOMPUTER");
> > > > > > otherwise it just runs on the current machine. I was testing
> > it out to
> > > > go
> > > > > > to my own computer so I didn't catch the error before. I got
> > this
> > > > partially
> > > > > > from the docs. Is this correct?
> > > > > > > Here's a 2 job (JScript/VBScript) .WSF WshController and
> > WshRemote
> > > > example
> > > > > > in case anyone is
> > > > > > > inclined. It will run "as is" on NT4 or Win2000
> > (WshController and
> > > > > > WshRemote are *NOT*
> > > > > > > installed/supported on Win9x for either the beta or the
> > final
> > > > release)...
> > > > > > > See the comments inline...
> > > > > > > <package>
> > > > > > > <comment>
> > > > > > > Use of WshRemote is NOT enabled by default.
> > > > > > > HKLM\SOFTWARE\Microsoft\Windows Script Host\Settings\Remote
> > > > > > > DWORD 0 - disabled
> > > > > > > DWORD 1 - enabled
> > > > > > > This example is based on the example in the beta
> > documentation
> > > > > > > for the CreateScript method. There are JScript and VBScript
> > > > > > > versions included as //Job:js //Job:vbs respectively.
> > > > > > > The following errors in the example in documentation on
> > which these
> > > > > > > examples are based have been corrected:
> > > > > > > - The progid is "WshController" (not
> > "WScript.WshController")
> > > > > > > - the WshRemote objects Status property is numeric (not
> > string).
> > > > > > > 0 -> No Task
> > > > > > > 1 -> Running
> > > > > > > 2 -> Finished
> > > > > > > Note that the Status property link from the WshRemote object
> > topic
> > > > > > > in the beta docs goes to the wrong topic - WshExec object's
> > Status.
> > > > > > > The Reference/Properties/Status (WshRemote) link goes to the
> > correct
> > > > > > > WshRemote.Status topic.
> > > > > > > Remarks:
> > > > > > > If a bad script path is passed to CreateScript, no error
> > occurs
> > > > > > > until Execute is called.
> > > > > > > Bugs:
> > > > > > > The WshRemote.Error.Line and Number properties both return
> > an
> > > > > > > unsigned long which is unsupported type in VBVScript. The
> > > > > > > workaround is to wrap references to these in CLng() or Hex()
> > > > > > > depending on what you need.
> > > > > > > </comment>
> > > > > > > <job id="js">
> > > > > > > <script language="JScript">
> > > > > > > var Controller = WScript.CreateObject("WshController");
> > > > > > > var RemoteScript =
> > > > > > > Controller.CreateScript("d:\\scripts\\myScript.js");
> > > > > > > WScript.Echo("connecting");
> > > > > > > WScript.ConnectObject(RemoteScript, "remote_");
> > > > > > > WScript.Echo("executing");
> > > > > > > RemoteScript.Execute();
> > > > > > > while (RemoteScript.Status != 2) {
> > > > > > > WScript.Sleep(100);
> > > > > > > }
> > > > > > > if (RemoteScript.Error.Number == 0) {
> > > > > > > WScript.Echo("Completed Successfully!");
> > > > > > > } else {
> > > > > > > //=====
> > > > > > > // Note: this will only be reached if you comment out or
> > > > > > > // remove the WSCript.Quit in the remote_Error() handler.
> > > > > > > //=====
> > > > > > > WScript.Echo("Failed!");
> > > > > > > }
> > > > > > > function remote_Error()
> > > > > > > {
> > > > > > > var theError = RemoteScript.Error;
> > > > > > > WScript.Echo("An Error Occurred at Line "
> > > > > > > + theError.Line + ", Char "
> > > > > > > + theError.Character
> > > > > > > + "\n"
> > > > > > > + theError.Number.toString(16)
> > > > > > > + "\n"
> > > > > > > + theError.Description
> > > > > > > );
> > > > > > > WScript.Quit(-1);
> > > > > > > }
> > > > > > > </script>
> > > > > > > </job>
> > > > > > > <job id="vbs">
> > > > > > > <script language="VBScript">
> > > > > > > set Controller = WScript.CreateObject("WshController")
> > > > > > > set RemoteScript = _
> > > > > > > Controller.CreateScript("d:\scripts\myScript.js")
> > > > > > > WScript.Echo("connecting")
> > > > > > > WScript.ConnectObject RemoteScript, "remote_"
> > > > > > > WScript.Echo("executing")
> > > > > > > RemoteScript.Execute
> > > > > > > do while RemoteScript.Status <> 2
> > > > > > > WScript.Sleep 100
> > > > > > > loop
> > > > > > > If CLng(RemoteScript.Error.Number) = 0 Then
> > > > > > > WScript.Echo "Completed Successfully!"
> > > > > > > Else
> > > > > > > '=====
> > > > > > > ' Note: this will only be reached if you comment out or
> > > > > > > ' remove the WSCript.Quit in the remote_Error() handler.
> > > > > > > '=====
> > > > > > > WScript.Echo "Failed!"
> > > > > > > End If
> > > > > > > function remote_Error()
> > > > > > > set theError = RemoteScript.Error
> > > > > > > WScript.Echo "An Error Occurred at Line " _
> > > > > > > & CLng(theError.Line) _
> > > > > > > & ", Char " _
> > > > > > > & theError.Character _
> > > > > > > & vbcrlf _
> > > > > > > & hex(theError.Number) _
> > > > > > > & vbcrlf _
> > > > > > > & theError.Description _
> > > > > > > & ""
> > > > > > > WScript.Quit -1
> > > > > > > end function
> > > > > > > </script>
> > > > > > > </job>
> > > > > > > </package>
> > > > > > > --
> > > > > > > Michael Harris
> > > > > > > Microsoft.MVP.Scripting
> > > > > > > --
> > > > > > > Please do not email questions - post them to the newsgroup
> > instead.
> > > > > > > --