Re: How do I request user right: SeShutdownPrivilege



Here is what I did to perform a remote reboot via ASP on IIS 6 /
Windows 2003:

1) Configure on the file system.

Under your wwwroot folder, (C:\Inetpub\wwwroot by default), create a
reboot folder.
Right-click the folder, Properties.

Security tab ->
Click [Advanced] and uncheck [ ] Allow inheritable permissions
Click [Copy] when prompted
Remove all but Administrators

2) Configure in IIS.

Open IIS Manager, Default Web Site, right-click reboot, Properties.

Directory tab ->
Execute Permissions: Scripts only

Documents tab ->
[x] Enable default content page
Default.asp

Directory Security tab ->
Click [Edit] under Authentication and access control
Uncheck everything, then check only [x] Integrated Windows
authentication

3) Create the ASP page

On the file system, create a file called default.asp under the reboot
folder.

<%

Response.write "<html>Rebooting now!</html>"

strPath = "winmgmts:{impersonationLevel=impersonate,(Shutdown)}\\.\root
\cimv2"
strQuery = "Select * from Win32_OperatingSystem"

Set objWMIService = GetObject(strPath)
Set colOperatingSystems = objWMIService.ExecQuery(strQuery)

For Each objOperatingSystem in colOperatingSystems
objOperatingSystem.Win32Shutdown(6) 'Restart
Next

%>

Now browse to http://yourcomputer/reboot/. If your computer is not in
the Intranet Zone, you will be prompted to login. Use an Administrator-
level account. Once logged in, the computer will reboot.

Hope that helps.

J Wolfgang Goerlich

On Jul 13, 8:21 am, "George Valkov" <a...@xxxxx> wrote:
Windows 2003 server SP2 enterprise,
IIS, ASP enabled, execute mode: script and executables.

How do I request this user right:
SeShutdownPrivilege
I do not seem to have it, when I run an ASP script on the server
as Asministrator. I want to restart the server from ASP.

Please give me either ASP or C++ implementation how to request
this user right... And thank You for any good web link too!

// details:
// login as administrator to local web site and GET:
//http://localhost/restart_test.exe
// Shutdown in progress dialog box is displayed on server's console.
// this is the desired behaviour, but I want to do it from ASP.

// login as administrator to local web site and GET:
//http://localhost/test.asp

// in the ASP I execute this server side script:
var WshShell=Server.CreateObject("WScript.Shell");

WshShell.Exec("C:\\Inetpub\\restart_test.exe");

var stdOutText=objCmd2.StdOut.Readall();
response.write(stdOutText);

// source code for restart_test.cpp
InitiateSystemShutdown(NULL, NULL, 300, false, true);
printf("[errorCode=%d]", GetLastError());

// The web page returns:
// [errorCode=5] // 5 = Access Denied

// this means that I am missing this right:
// SeShutdownPrivilege


.



Relevant Pages

  • Re: SBS 2003 IIS and ASP .NET Question
    ... What happens if you go into IIS Admin. ... Expand Default Web Site, r-click ... Remote -> Properties and switch just Remote back to 1.1? ... Can someone please confirm that ASP .NET must be set to V1 for all the ...
    (microsoft.public.windows.server.sbs)
  • Re: IIS problem: "The page cannot be found" (But it is there!!)
    ... Check your IIS settings that you are allowing scripting for .asp extensions. ... > If you reached this page by clicking a link, contact the Web site ... > Open IIS Help, which is accessible in IIS Manager, and search ...
    (microsoft.public.win2000.general)
  • Re: IIS ssl problem
    ... my main problem is i get dns error when iis server busy ... (at this time cpu usage is about 2%,3% also memory usage ... Web Site" also ssl port set 443 and IP set ... look asp pages yet other company wrote these code.but our ...
    (microsoft.public.inetserver.iis)
  • Re: IIS 5.1 execution questions - application failed to initialize
    ... Permissions problems can be troubleshooted using Filemon and Regmon from ... > I'm running IIS 5.1 on my XP Pro development system. ... > shell out to an exe (in an ASP page) using code like: ... > the executable to the web site and use either a web address or an ...
    (microsoft.public.inetserver.iis)
  • Re: ASP fails on published site but not new sites
    ... For ASP to run on an IIS web site, the web site must have an Application ... open the IIS Admin snap-in and right-click ...
    (microsoft.public.frontpage.programming)