Execute WSH script from Web 
Author Message
 Execute WSH script from Web

Okay, how could I simply execute a WSH script from a web page, and have the
script run on the web server itself?

-M



Tue, 06 Jul 2004 06:03:30 GMT  
 Execute WSH script from Web
Your best bet would be to port it over to an ASP script.

--

=============================
Kyle M. Burns, MCSD, MCT


Quote:
> Okay, how could I simply execute a WSH script from a web page, and have
the
> script run on the web server itself?

> -M



Tue, 06 Jul 2004 08:25:59 GMT  
 Execute WSH script from Web
You can create/use a WScript.Shell object to use its Run method in server side ASP code.  But you are likely to have problems if you do this via anonymous access.

What's your objective?  There may be a simpler solution...

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> Okay, how could I simply execute a WSH script from a web page, and have the
> script run on the web server itself?

> -M



Tue, 06 Jul 2004 09:08:08 GMT  
 Execute WSH script from Web
I want to be able to start a script that actually runs on a server without
having to log into the server or take remote control of it. I also want
rewrite the logging of the script to output to the web site rather than text
file.

    Could I impersonate the administrator account an launch the script? All
people who have access to the web site know the admin password, not
concerned about security.

Should I wish to rewrite the script to ASP how would I open the WScript
object? How about issues of remote scripting?

-M



You can create/use a WScript.Shell object to use its Run method in server
side ASP code.  But you are likely to have problems if you do this via
anonymous access.

What's your objective?  There may be a simpler solution...

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:
> Okay, how could I simply execute a WSH script from a web page, and have
the
> script run on the web server itself?

> -M



Tue, 06 Jul 2004 23:32:59 GMT  
 Execute WSH script from Web
You should look into the new WshController/WshRemote capabilities introduced in WSH 5.6 for exactly this kind of task...

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> I want to be able to start a script that actually runs on a server without
> having to log into the server or take remote control of it. I also want
> rewrite the logging of the script to output to the web site rather than text
> file.

>     Could I impersonate the administrator account an launch the script? All
> people who have access to the web site know the admin password, not
> concerned about security.

> Should I wish to rewrite the script to ASP how would I open the WScript
> object? How about issues of remote scripting?

> -M



> You can create/use a WScript.Shell object to use its Run method in server
> side ASP code.  But you are likely to have problems if you do this via
> anonymous access.

> What's your objective?  There may be a simpler solution...

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --


> > Okay, how could I simply execute a WSH script from a web page, and have
> the
> > script run on the web server itself?

> > -M



Wed, 07 Jul 2004 00:53:52 GMT  
 Execute WSH script from Web
Sorry, I guess I stated that wrong, The script I have restore an testing
enviroment, the script must run within a resource domain, on a certain
computer(for WSH version reasons as well a security level). The script
itself uses remote scripting to execute code on some on other servers inside
said resource domain.
    I have a web server setup on the server that the script must be run on,
I want to be able to execute the script on that server through a web
command, so the restore can be started from other domains and locations.
    I really could not remotly start the main script from our workstations
because they are in several different domain, as well as over WAN or VPN
links.

Could I instanciate WSHScript in ASP and perform a RUNAS command to start
the script?



You should look into the new WshController/WshRemote capabilities introduced
in WSH 5.6 for exactly this kind of task...

--
Michael Harris
Microsoft.MVP.Scripting
--


Quote:
> I want to be able to start a script that actually runs on a server without
> having to log into the server or take remote control of it. I also want
> rewrite the logging of the script to output to the web site rather than
text
> file.

>     Could I impersonate the administrator account an launch the script?
All
> people who have access to the web site know the admin password, not
> concerned about security.

> Should I wish to rewrite the script to ASP how would I open the WScript
> object? How about issues of remote scripting?

> -M



> You can create/use a WScript.Shell object to use its Run method in server
> side ASP code.  But you are likely to have problems if you do this via
> anonymous access.

> What's your objective?  There may be a simpler solution...

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --


> > Okay, how could I simply execute a WSH script from a web page, and have
> the
> > script run on the web server itself?

> > -M



Wed, 07 Jul 2004 02:17:25 GMT  
 Execute WSH script from Web
How can I use WSH in ASP?



Quote:
> Your best bet would be to port it over to an ASP script.

> --

> =============================
> Kyle M. Burns, MCSD, MCT



> > Okay, how could I simply execute a WSH script from a web page, and have
> the
> > script run on the web server itself?

> > -M



Wed, 07 Jul 2004 02:18:02 GMT  
 Execute WSH script from Web
Hi guys,

Michael... I want to do something very similar... What
kind of problems shoud I expect if I do this via anonymous
access (I suppose you mean on a web page without any
username/password)??? Is there a solution... I don't
know... connect to the server (through the web page) with
(or for) WSH.

Pierre

Quote:
>-----Original Message-----
>You can create/use a WScript.Shell object to use its Run

method in server side ASP code.  But you are likely to
have problems if you do this via anonymous access.
Quote:

>What's your objective?  There may be a simpler solution...

>--
>Michael Harris
>Microsoft.MVP.Scripting
>--



Quote:
>> Okay, how could I simply execute a WSH script from a

web page, and have the
Quote:
>> script run on the web server itself?

>> -M

>.



Sat, 10 Jul 2004 02:17:56 GMT  
 Execute WSH script from Web
Access to the IIS machine's resources under the IUSR_machinename anonymous account will be more restricted that access for an authenticated domain user account, meaning NTLM/Kerberos integrated security or Basic authentication.  And for access to any resource on a server other that the IIS machine, you will need to use either Basic or Kerberos on a Windows 2000 domain since NTLM won't enable you to make any machine hops...

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:

> Hi guys,

> Michael... I want to do something very similar... What
> kind of problems shoud I expect if I do this via anonymous
> access (I suppose you mean on a web page without any
> username/password)??? Is there a solution... I don't
> know... connect to the server (through the web page) with
> (or for) WSH.

> Pierre

> >-----Original Message-----
> >You can create/use a WScript.Shell object to use its Run
> method in server side ASP code.  But you are likely to
> have problems if you do this via anonymous access.

> >What's your objective?  There may be a simpler solution...

> >--
> >Michael Harris
> >Microsoft.MVP.Scripting
> >--


> >> Okay, how could I simply execute a WSH script from a
> web page, and have the
> >> script run on the web server itself?

> >> -M

> >.



Sat, 10 Jul 2004 05:15:06 GMT  
 Execute WSH script from Web
Here's an example I pull from one of my scripts; it may help.

<%

dim wshShell
set wshShell = CreateObject("WScript.Shell")
shellexec = wshshell.Run("c:\dir")
set wshshell = Nothing

%>

Lee

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!



Sat, 10 Jul 2004 06:25:19 GMT  
 Execute WSH script from Web
Michael,

Can you expand on how one might do the authentication for allowing the
server scripts to run. I think this is my problem. I can't get a simple
piping of a dir command to a text file from an ASP page even though the
target directory is write enabled. (I eventually want to execute a utility,
Testing.exe for instance). I am trying to use the standard code shown in the
docs:

//-------------------------------------------------------------------------
var szInfo = "";
var wshell = Server.CreateObject("WScript.Shell");
szInfo += "Special folders(AllUsersDesktop): " +
wshell.SpecialFolders("AllUsersDesktop");

That last line returns information so I know the shell is working. I then
have this:

var szDir = Server.MapPath("/Data");
var szCmd = "cmd /C CD " + szDir + " & Dir >testinfo.dat";
var rtnCode = wshell.Run(szCmd);
//--------------------------------------------------------------------------
--
It won't create the file. The return code is always 0.

Do you have suggestions and/or locations to find sample code for doing
authentication from within an ASP page...if this is my problem.
Thanks,
Gery D. Dorazio



Access to the IIS machine's resources under the IUSR_machinename anonymous
account will be more restricted that access for an authenticated domain user
account, meaning NTLM/Kerberos integrated security or Basic authentication.
And for access to any resource on a server other that the IIS machine, you
will need to use either Basic or Kerberos on a Windows 2000 domain since
NTLM won't enable you to make any machine hops...

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:
> Hi guys,

> Michael... I want to do something very similar... What
> kind of problems shoud I expect if I do this via anonymous
> access (I suppose you mean on a web page without any
> username/password)??? Is there a solution... I don't
> know... connect to the server (through the web page) with
> (or for) WSH.

> Pierre

> >-----Original Message-----
> >You can create/use a WScript.Shell object to use its Run
> method in server side ASP code.  But you are likely to
> have problems if you do this via anonymous access.

> >What's your objective?  There may be a simpler solution...

> >--
> >Michael Harris
> >Microsoft.MVP.Scripting
> >--


> >> Okay, how could I simply execute a WSH script from a
> web page, and have the
> >> script run on the web server itself?

> >> -M

> >.



Tue, 13 Jul 2004 14:54:31 GMT  
 Execute WSH script from Web
Check the WshShell.Run documentation...  

The value returned from Run is *always* 0 *unless* you tell Run to wait for completion of whatever it is executing.

var rtnCode = wshell.Run(szCmd,0.true);

--
Michael Harris
Microsoft.MVP.Scripting
--

Quote:
> Michael,

> Can you expand on how one might do the authentication for allowing the
> server scripts to run. I think this is my problem. I can't get a simple
> piping of a dir command to a text file from an ASP page even though the
> target directory is write enabled. (I eventually want to execute a utility,
> Testing.exe for instance). I am trying to use the standard code shown in the
> docs:

> //-------------------------------------------------------------------------
> var szInfo = "";
> var wshell = Server.CreateObject("WScript.Shell");
> szInfo += "Special folders(AllUsersDesktop): " +
> wshell.SpecialFolders("AllUsersDesktop");

> That last line returns information so I know the shell is working. I then
> have this:

> var szDir = Server.MapPath("/Data");
> var szCmd = "cmd /C CD " + szDir + " & Dir >testinfo.dat";
> var rtnCode = wshell.Run(szCmd);
> //--------------------------------------------------------------------------
> --
> It won't create the file. The return code is always 0.

> Do you have suggestions and/or locations to find sample code for doing
> authentication from within an ASP page...if this is my problem.
> Thanks,
> Gery D. Dorazio



> Access to the IIS machine's resources under the IUSR_machinename anonymous
> account will be more restricted that access for an authenticated domain user
> account, meaning NTLM/Kerberos integrated security or Basic authentication.
> And for access to any resource on a server other that the IIS machine, you
> will need to use either Basic or Kerberos on a Windows 2000 domain since
> NTLM won't enable you to make any machine hops...

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --


> > Hi guys,

> > Michael... I want to do something very similar... What
> > kind of problems shoud I expect if I do this via anonymous
> > access (I suppose you mean on a web page without any
> > username/password)??? Is there a solution... I don't
> > know... connect to the server (through the web page) with
> > (or for) WSH.

> > Pierre

> > >-----Original Message-----
> > >You can create/use a WScript.Shell object to use its Run
> > method in server side ASP code.  But you are likely to
> > have problems if you do this via anonymous access.

> > >What's your objective?  There may be a simpler solution...

> > >--
> > >Michael Harris
> > >Microsoft.MVP.Scripting
> > >--


> > >> Okay, how could I simply execute a WSH script from a
> > web page, and have the
> > >> script run on the web server itself?

> > >> -M

> > >.



Wed, 14 Jul 2004 08:35:49 GMT  
 Execute WSH script from Web
I actually do have wshell.Run(szCmd,2,true); and it still returns 0 and
doesn't create the file on a write enabled directory from an ASP file. I
have looked at some security documentation with regard to ASP/IIS and it is
not the same as the Windows NT/2000 security model. Any other suggestions?
Thanks,
Gery



Check the WshShell.Run documentation...

The value returned from Run is *always* 0 *unless* you tell Run to wait for
completion of whatever it is executing.

var rtnCode = wshell.Run(szCmd,0.true);

--
Michael Harris
Microsoft.MVP.Scripting
--


Quote:
> Michael,

> Can you expand on how one might do the authentication for allowing the
> server scripts to run. I think this is my problem. I can't get a simple
> piping of a dir command to a text file from an ASP page even though the
> target directory is write enabled. (I eventually want to execute a
utility,
> Testing.exe for instance). I am trying to use the standard code shown in
the
> docs:

//-------------------------------------------------------------------------
Quote:
> var szInfo = "";
> var wshell = Server.CreateObject("WScript.Shell");
> szInfo += "Special folders(AllUsersDesktop): " +
> wshell.SpecialFolders("AllUsersDesktop");

> That last line returns information so I know the shell is working. I then
> have this:

> var szDir = Server.MapPath("/Data");
> var szCmd = "cmd /C CD " + szDir + " & Dir >testinfo.dat";
> var rtnCode = wshell.Run(szCmd);

//--------------------------------------------------------------------------
Quote:
> --
> It won't create the file. The return code is always 0.

> Do you have suggestions and/or locations to find sample code for doing
> authentication from within an ASP page...if this is my problem.
> Thanks,
> Gery D. Dorazio



> Access to the IIS machine's resources under the IUSR_machinename anonymous
> account will be more restricted that access for an authenticated domain
user
> account, meaning NTLM/Kerberos integrated security or Basic
authentication.
> And for access to any resource on a server other that the IIS machine, you
> will need to use either Basic or Kerberos on a Windows 2000 domain since
> NTLM won't enable you to make any machine hops...

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --


> > Hi guys,

> > Michael... I want to do something very similar... What
> > kind of problems shoud I expect if I do this via anonymous
> > access (I suppose you mean on a web page without any
> > username/password)??? Is there a solution... I don't
> > know... connect to the server (through the web page) with
> > (or for) WSH.

> > Pierre

> > >-----Original Message-----
> > >You can create/use a WScript.Shell object to use its Run
> > method in server side ASP code.  But you are likely to
> > have problems if you do this via anonymous access.

> > >What's your objective?  There may be a simpler solution...

> > >--
> > >Michael Harris
> > >Microsoft.MVP.Scripting
> > >--


> > >> Okay, how could I simply execute a WSH script from a
> > web page, and have the
> > >> script run on the web server itself?

> > >> -M

> > >.



Sun, 18 Jul 2004 06:20:07 GMT  
 Execute WSH script from Web
Michael,

The ASP page is on an online server and I execute it through a web browser
from my office. The server is not local so I am not on the server as an
administrator or anything like that. It is a shared host environment where I
create the site with Visual InterDev and then test with IE.

Thanks,
Gery



Check the WshShell.Run documentation...

The value returned from Run is *always* 0 *unless* you tell Run to wait for
completion of whatever it is executing.

var rtnCode = wshell.Run(szCmd,0.true);

--
Michael Harris
Microsoft.MVP.Scripting
--


Quote:
> Michael,

> Can you expand on how one might do the authentication for allowing the
> server scripts to run. I think this is my problem. I can't get a simple
> piping of a dir command to a text file from an ASP page even though the
> target directory is write enabled. (I eventually want to execute a
utility,
> Testing.exe for instance). I am trying to use the standard code shown in
the
> docs:

//-------------------------------------------------------------------------
Quote:
> var szInfo = "";
> var wshell = Server.CreateObject("WScript.Shell");
> szInfo += "Special folders(AllUsersDesktop): " +
> wshell.SpecialFolders("AllUsersDesktop");

> That last line returns information so I know the shell is working. I then
> have this:

> var szDir = Server.MapPath("/Data");
> var szCmd = "cmd /C CD " + szDir + " & Dir >testinfo.dat";
> var rtnCode = wshell.Run(szCmd);

//--------------------------------------------------------------------------
Quote:
> --
> It won't create the file. The return code is always 0.

> Do you have suggestions and/or locations to find sample code for doing
> authentication from within an ASP page...if this is my problem.
> Thanks,
> Gery D. Dorazio



> Access to the IIS machine's resources under the IUSR_machinename anonymous
> account will be more restricted that access for an authenticated domain
user
> account, meaning NTLM/Kerberos integrated security or Basic
authentication.
> And for access to any resource on a server other that the IIS machine, you
> will need to use either Basic or Kerberos on a Windows 2000 domain since
> NTLM won't enable you to make any machine hops...

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --


> > Hi guys,

> > Michael... I want to do something very similar... What
> > kind of problems shoud I expect if I do this via anonymous
> > access (I suppose you mean on a web page without any
> > username/password)??? Is there a solution... I don't
> > know... connect to the server (through the web page) with
> > (or for) WSH.

> > Pierre

> > >-----Original Message-----
> > >You can create/use a WScript.Shell object to use its Run
> > method in server side ASP code.  But you are likely to
> > have problems if you do this via anonymous access.

> > >What's your objective?  There may be a simpler solution...

> > >--
> > >Michael Harris
> > >Microsoft.MVP.Scripting
> > >--


> > >> Okay, how could I simply execute a WSH script from a
> > web page, and have the
> > >> script run on the web server itself?

> > >> -M

> > >.



Sun, 18 Jul 2004 10:40:27 GMT  
 
 [ 14 post ] 

 Relevant Pages 

1. Executing a WSH script as a login script

2. Using VB Script to execute an EXE file from a Web Browser

3. Executing a WSH script inside of a HTML page

4. Problem Executing WSH script and getting a result with ASPExec

5. Executing a wsh script in a html page

6. can windows 95 clients execute wsh scripts?

7. execute WSH scripts within a browser

8. Executing WSH Scripts within a Browser

9. WSH Script to save a web page as a text file - dialogue box problem

10. WSH as a Web page script

11. Mapping Web Folders (Network Places via login script or wsh

12. Executing through the web

 

 
Powered by phpBB® Forum Software