Re: How do I request user right: SeShutdownPrivilege
- From: jwgoerlich@xxxxxxxxx
- Date: Fri, 13 Jul 2007 10:02:13 -0700
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
.
- Follow-Ups:
- Re: How do I request user right: SeShutdownPrivilege
- From: George Valkov
- Re: How do I request user right: SeShutdownPrivilege
- References:
- How do I request user right: SeShutdownPrivilege
- From: George Valkov
- How do I request user right: SeShutdownPrivilege
- Prev by Date: How do I request user right: SeShutdownPrivilege
- Next by Date: Re: Null Sessions
- Previous by thread: How do I request user right: SeShutdownPrivilege
- Next by thread: Re: How do I request user right: SeShutdownPrivilege
- Index(es):
Relevant Pages
|