WSH 5.6 b 1 Remote Exec 
Author Message
 WSH 5.6 b 1 Remote Exec

While we are waiting breathlessly for the documentation. Has anybody
got an example of the the WshRemote object?

Michael Janos

Sent via Deja.com http://www.*-*-*.com/
Before you buy.



Tue, 13 May 2003 10:56:27 GMT  
 WSH 5.6 b 1 Remote Exec

This isn't complete, but hopefully it will get you started. Note: this will
only work on WinNT and Win2K - there is no support for remote scripting to
or from Win9x due to security issues. And, as the WinNT setup package still
isn't quite right, it probably won't work there, too - again, sorry about
the install problems.

First, you need to enable it - it ships disabled by default. To enable, you
need to muck about in the registry, and there are three keys you'll need to
know about:
A) HKLM\Software\Microsoft\Windows Script Host\Settings\Remote
B) HKCU\Software\Microsoft\Windows Script Host\Settings\Remote
C) HKLM\Software\Microsoft\Windows Script Host\Settings\IgnoreUserSettings

A enables remote by machine, and B by user - 1 turns it on, 0 turns it off.
If C is 1, then B is ignored and only the setting from A is read. If C is 0,
then first WSH checks B and falls back on A if B doesn't exist (we don't
create B automatically - you should create that yourself if you need to
control remoting on a user-by-user basis).

The following script shows how to use Remote WSH.

-------------------------------------
var WshController = new ActiveXObject("WSHController);
var RemoteScript =
WshController.CreateScript("c:\\localpath\\somescript.wsf",
"remotemachinename");

// Status should be 0 at this point - let's check
WScript.Echo("Current Status is " + RemoteScript.status);

// Let's catch the events
WScript.ConnectObject(RemoteScript, "RemoteScript_");

// Let's start the script
RemoteScript.Execute();

// If it's not done, the status should be 1
WScript.Echo("Current Status is " + RemoteScript.status);

// Wait for it to finish
while (RemoteScript.Status != 2)
{
    WScript.Sleep(100);

Quote:
}

// Let's check the status, just for fun - should be 2
WScript.Echo("Current Status is " + RemoteScript.status);

// How about some functions to catch the events
function RemoteScript_Start()
{
    WScript.Echo("The script has started on the remote machine");

Quote:
}

function RemoteScript_End()
{
    WScript.Echo("The script has finished on the remote machine");

Quote:
}

function RemoteScript_Error()
{
    var str = "An error has occurred\n";
    var ErrorObject = RemoteScript.Error;

    str += "Description: " + ErrorObject.Description + "\n";
    str += "Line Number: " + ErrorObject.Line + "\n";
    str += "Character: " + ErrorObject.Character + "\n";
    str += "Source: " + ErrorObject.Source + "\n";
    str += "Source Text: " + ErrorObject.SourceText + "\n";
    str += "Number: " + ErrorObject.Number + "\n";

    WScript.Echo(str);

Quote:
}

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

Hope this helps. I'm not sure of the status of the docs right now, so feel
free to post any questions to the group and I'll try to answer them
promptly.

Mike Whalen
Windows Script Dev


Quote:
> While we are waiting breathlessly for the documentation. Has anybody
> got an example of the the WshRemote object?

> Michael Janos

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Fri, 16 May 2003 03:00:00 GMT  
 WSH 5.6 b 1 Remote Exec
Thanks for the information. I am a bit disappointed that I cannot use
it from a win9x machine. I can understand stopping it working on a
win9x machine but I want it to control an NT4 machine from a win9x
client. I thought that this would be okay as the NT4 can protect itself.

regards,
Michael Janos


Quote:

> This isn't complete, but hopefully it will get you started. Note:
this will
> only work on WinNT and Win2K - there is no support for remote
scripting to
> or from Win9x due to security issues. And, as the WinNT setup package
still
> isn't quite right, it probably won't work there, too - again, sorry
about
> the install problems.

Sent via Deja.com http://www.deja.com/
Before you buy.


Fri, 16 May 2003 03:00:00 GMT  
 WSH 5.6 b 1 Remote Exec
I update the relevant registry A and C to 1 (on both machines), then
try to run the script you posted but get back the following message:

Microsoft JScript runtime error: Permission denied

Both machines are Windows 2000 machines with the WScript 5.6 Beta 1
installed.  Any ideas?  Is there a way to pass a username and password
to create the script?

Also, any idea on when the doc should come out (weeks, months ...)

Thanks
kslinde



Quote:

> This isn't complete, but hopefully it will get you started. Note:
this will
> only work on WinNT and Win2K - there is no support for remote
scripting to
> or from Win9x due to security issues. And, as the WinNT setup package
still
> isn't quite right, it probably won't work there, too - again, sorry
about
> the install problems.

> First, you need to enable it - it ships disabled by default. To
enable, you
> need to muck about in the registry, and there are three keys you'll
need to
> know about:
> A) HKLM\Software\Microsoft\Windows Script Host\Settings\Remote
> B) HKCU\Software\Microsoft\Windows Script Host\Settings\Remote
> C) HKLM\Software\Microsoft\Windows Script

Host\Settings\IgnoreUserSettings

- Show quoted text -

Quote:

> A enables remote by machine, and B by user - 1 turns it on, 0 turns
it off.
> If C is 1, then B is ignored and only the setting from A is read. If
C is 0,
> then first WSH checks B and falls back on A if B doesn't exist (we
don't
> create B automatically - you should create that yourself if you need
to
> control remoting on a user-by-user basis).

> The following script shows how to use Remote WSH.

> -------------------------------------
> var WshController = new ActiveXObject("WSHController);
> var RemoteScript =
> WshController.CreateScript("c:\\localpath\\somescript.wsf",
> "remotemachinename");

> // Status should be 0 at this point - let's check
> WScript.Echo("Current Status is " + RemoteScript.status);

> // Let's catch the events
> WScript.ConnectObject(RemoteScript, "RemoteScript_");

> // Let's start the script
> RemoteScript.Execute();

> // If it's not done, the status should be 1
> WScript.Echo("Current Status is " + RemoteScript.status);

> // Wait for it to finish
> while (RemoteScript.Status != 2)
> {
>     WScript.Sleep(100);
> }

> // Let's check the status, just for fun - should be 2
> WScript.Echo("Current Status is " + RemoteScript.status);

> // How about some functions to catch the events
> function RemoteScript_Start()
> {
>     WScript.Echo("The script has started on the remote machine");
> }

> function RemoteScript_End()
> {
>     WScript.Echo("The script has finished on the remote machine");
> }

> function RemoteScript_Error()
> {
>     var str = "An error has occurred\n";
>     var ErrorObject = RemoteScript.Error;

>     str += "Description: " + ErrorObject.Description + "\n";
>     str += "Line Number: " + ErrorObject.Line + "\n";
>     str += "Character: " + ErrorObject.Character + "\n";
>     str += "Source: " + ErrorObject.Source + "\n";
>     str += "Source Text: " + ErrorObject.SourceText + "\n";
>     str += "Number: " + ErrorObject.Number + "\n";

>     WScript.Echo(str);
> }
> ---------------------------------------------

> Hope this helps. I'm not sure of the status of the docs right now, so
feel
> free to post any questions to the group and I'll try to answer them
> promptly.

> Mike Whalen
> Windows Script Dev



> > While we are waiting breathlessly for the documentation. Has anybody
> > got an example of the the WshRemote object?

> > Michael Janos

> > Sent via Deja.com http://www.deja.com/
> > Before you buy.

Sent via Deja.com http://www.deja.com/
Before you buy.


Sat, 31 May 2003 09:24:05 GMT  
 WSH 5.6 b 1 Remote Exec

I've been playing with this a bit, but can't repro. Does the account that's
running the script have the correct permissions on the remote machine?
You'll need that. We don't have a way to impersonate another user - the
account you are running under on the original machine must have permissions
on the remote machine.

Mike Whalen
Windows Script Dev

Quote:

> I update the relevant registry A and C to 1 (on both machines), then
> try to run the script you posted but get back the following message:

> Microsoft JScript runtime error: Permission denied

> Both machines are Windows 2000 machines with the WScript 5.6 Beta 1
> installed.  Any ideas?  Is there a way to pass a username and password
> to create the script?

> Also, any idea on when the doc should come out (weeks, months ...)

> Thanks
> kslinde



> > This isn't complete, but hopefully it will get you started. Note:
> this will
> > only work on WinNT and Win2K - there is no support for remote
> scripting to
> > or from Win9x due to security issues. And, as the WinNT setup package
> still
> > isn't quite right, it probably won't work there, too - again, sorry
> about
> > the install problems.

> > First, you need to enable it - it ships disabled by default. To
> enable, you
> > need to muck about in the registry, and there are three keys you'll
> need to
> > know about:
> > A) HKLM\Software\Microsoft\Windows Script Host\Settings\Remote
> > B) HKCU\Software\Microsoft\Windows Script Host\Settings\Remote
> > C) HKLM\Software\Microsoft\Windows Script
> Host\Settings\IgnoreUserSettings

> > A enables remote by machine, and B by user - 1 turns it on, 0 turns
> it off.
> > If C is 1, then B is ignored and only the setting from A is read. If
> C is 0,
> > then first WSH checks B and falls back on A if B doesn't exist (we
> don't
> > create B automatically - you should create that yourself if you need
> to
> > control remoting on a user-by-user basis).

> > The following script shows how to use Remote WSH.

> > -------------------------------------
> > var WshController = new ActiveXObject("WSHController);
> > var RemoteScript =
> > WshController.CreateScript("c:\\localpath\\somescript.wsf",
> > "remotemachinename");

> > // Status should be 0 at this point - let's check
> > WScript.Echo("Current Status is " + RemoteScript.status);

> > // Let's catch the events
> > WScript.ConnectObject(RemoteScript, "RemoteScript_");

> > // Let's start the script
> > RemoteScript.Execute();

> > // If it's not done, the status should be 1
> > WScript.Echo("Current Status is " + RemoteScript.status);

> > // Wait for it to finish
> > while (RemoteScript.Status != 2)
> > {
> >     WScript.Sleep(100);
> > }

> > // Let's check the status, just for fun - should be 2
> > WScript.Echo("Current Status is " + RemoteScript.status);

> > // How about some functions to catch the events
> > function RemoteScript_Start()
> > {
> >     WScript.Echo("The script has started on the remote machine");
> > }

> > function RemoteScript_End()
> > {
> >     WScript.Echo("The script has finished on the remote machine");
> > }

> > function RemoteScript_Error()
> > {
> >     var str = "An error has occurred\n";
> >     var ErrorObject = RemoteScript.Error;

> >     str += "Description: " + ErrorObject.Description + "\n";
> >     str += "Line Number: " + ErrorObject.Line + "\n";
> >     str += "Character: " + ErrorObject.Character + "\n";
> >     str += "Source: " + ErrorObject.Source + "\n";
> >     str += "Source Text: " + ErrorObject.SourceText + "\n";
> >     str += "Number: " + ErrorObject.Number + "\n";

> >     WScript.Echo(str);
> > }
> > ---------------------------------------------

> > Hope this helps. I'm not sure of the status of the docs right now, so
> feel
> > free to post any questions to the group and I'll try to answer them
> > promptly.

> > Mike Whalen
> > Windows Script Dev



> > > While we are waiting breathlessly for the documentation. Has anybody
> > > got an example of the the WshRemote object?

> > > Michael Janos

> > > Sent via Deja.com http://www.deja.com/
> > > Before you buy.

> Sent via Deja.com http://www.deja.com/
> Before you buy.



Mon, 02 Jun 2003 07:08:04 GMT  
 WSH 5.6 b 1 Remote Exec
I got the same problem. I however changed the settings on the server
to

HKCU/..../Remote = 1
HKLM/..../Remote = 0
HKLM/..../IgnoreUserSettings = 1
(Which is a little counter-intuitive)

And now I get a new error "ActiveX cannot create object" on the the
wshcontroller.createscript(..) line. This is after quite a long pause
so I assume it is some kind of DCOM error. I haven't had any time to
chase this latest error down.

Michael Janos


Quote:

> I update the relevant registry A and C to 1 (on both machines), then
> try to run the script you posted but get back the following message:

> Microsoft JScript runtime error: Permission denied

> Both machines are Windows 2000 machines with the WScript 5.6 Beta 1
> installed.  Any ideas?  Is there a way to pass a username and password
> to create the script?

> Also, any idea on when the doc should come out (weeks, months ...)

> Thanks
> kslinde




Sent via Deja.com
http://www.deja.com/


Mon, 02 Jun 2003 18:22:51 GMT  
 WSH 5.6 b 1 Remote Exec

Just out of curiosity - what exactly is counterintuitive about that? That
will disable creating remote scripts on that machine - because you are
ignoring user settings, the 0 in the HKLM hive will be used, and you won't
be able to create the object.

Mike Whalen
Windows Script Dev


Quote:
> I got the same problem. I however changed the settings on the server
> to

> HKCU/..../Remote = 1
> HKLM/..../Remote = 0
> HKLM/..../IgnoreUserSettings = 1
> (Which is a little counter-intuitive)

> And now I get a new error "ActiveX cannot create object" on the the
> wshcontroller.createscript(..) line. This is after quite a long pause
> so I assume it is some kind of DCOM error. I haven't had any time to
> chase this latest error down.

> Michael Janos



> > I update the relevant registry A and C to 1 (on both machines), then
> > try to run the script you posted but get back the following message:

> > Microsoft JScript runtime error: Permission denied

> > Both machines are Windows 2000 machines with the WScript 5.6 Beta 1
> > installed.  Any ideas?  Is there a way to pass a username and password
> > to create the script?

> > Also, any idea on when the doc should come out (weeks, months ...)

> > Thanks
> > kslinde



> Sent via Deja.com
> http://www.deja.com/



Tue, 03 Jun 2003 02:45:58 GMT  
 
 [ 7 post ] 

 Relevant Pages 

1. WSH 5.6 Beta - Shell.Exec

2. WSH 5.6 WshShell.Exec - Minimized Window?

3. wsh 5.6 beta 2 bug - floppy access during exec

4. WSH 5.6 Beta 1, new method, WScript.Exec

5. WSH 5.6 beta - Shell.Exec

6. WSH 5.6 remote scripting - WSHController

7. Problems using remote capabilities of WSH 5.6

8. Remote scripting with WSH 5.6

9. Running Remote Batch Files With WSH 5.6

10. WSH 5.6 and Remote Scripting

11. BUG in WSH 5.6 install if Wscript.exe is running while updating WSH

12. BUG in WSH 5.6 install if Wscript.exe is running while updating WSH

 

 
Powered by phpBB® Forum Software