Re: Create a Shell Object in ASP

From: Oliver Gräser (epsilonrquadrat_at_gmx.de)
Date: 07/09/04


Date: Fri, 09 Jul 2004 19:39:10 +0200

Sorry, don't understand the elevated permissions part. As far as I got
it, I cannot create WScript Objects running the IIS because it is a
different Scripting Host. Anyway, if I have this line

<%
Set objShell = WScript.CreateObject("Wscript.Shell")
Set objExecObject = objShell.Exec("cmd /c ntbackup backup _
""@C:\total.bks"" /J ""Alles"" /F ""X:\total.bkf"" /L:s ")
%>
in an ASP at a place where it is run, nothing happens.
For the workaround: Yep, I already have some scripts in the scheduler.
But for somem occasions we need extra backups, and some prerequisites
(stopping sql server, connecting to NAS etc) done. And I thought it
would come in handy if we could just do so by opening the web browser,
clicking some buttons and voila. Because otherwise, people tend to
forget something (like mounting the correct drive etc) and then backup
fails. It is only a tiny network without access from outside, so there
shouldn't be any harm.

Regards,

Oliver

Aaron [SQL Server MVP] schrieb:
> You need elevated permissions: Set Shell = CreateObject("WScript.Shell")
>
> A better plan is to store the commands in a table or text file, and have a
> batch file wake up on a schedule (say every minute) and run all the tasks in
> the table or file. Then you don't have to worry about making your anonymous
> web user an administrator of the box... just a thought.
>