Solved

How to Issue "iisreset" command from ASP page

Posted on 2009-05-07
7
3,072 Views
Last Modified: 2012-06-27
I've got a problem application that requires that the IIS services be restarted often.  I want to allow non administrators to reset the IIS services on this box by visiting a web page that gives them a button to execute this.

I wrote the code below and it is getting the following access denied error (below).  I have the virtual directory anonymous access running under local admin credentials on the box, so I'm not understanding this error.  I'm testing the code on XP SP3.

This is the output: "IIS Reset - Access denied, you must be an administrator of the remote computer to use this command. Either have your account added to the administrator local group of the remote computer or to the domain administrator global group. "

I realize that this is not a good security practice, but desperate times call for ...
Sub IISReset()
  Set WshShell = CreateObject("WScript.Shell")
  Set strResponse = WshShell.Exec("iisreset")
  Set WshShell = Nothing
  Response.Write("IIS Reset - " & strResponse.stdOut.ReadAll())
End Sub

Open in new window

0
Comment
Question by:sarg_man
  • 3
  • 2
  • 2
7 Comments
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 24330659
0
 
LVL 13

Expert Comment

by:Praveen DM
ID: 24379585
give access to the IUSR_sitemachine name on CMD and then give a try...
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 24389283
> give access to the IUSR_sitemachine name on CMD and then give a try

Basiclay that means, "Come and Hack/Destroy my server"
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 13

Expert Comment

by:Praveen DM
ID: 24389347
hmmm yeah... thats what... Its the most risky permission that needs to be watched...
0
 
LVL 1

Author Comment

by:sarg_man
ID: 24395417
the web page is running under local admin privs.  I created a virtual directory and set the security to run as local admin.  The ASP page is access under that virtual dir.  In this case, the IUSR account shouldn't have anything to do with it, right?

adilkhan: I did look over the code the MS provided but don't think it is going to work since it calls methods to stop IIS services, then start them.   Once the services are stopped, the script is going to halt since the web page / script was being run by IIS.
0
 
LVL 13

Expert Comment

by:Praveen DM
ID: 24399638
0
 
LVL 1

Accepted Solution

by:
sarg_man earned 0 total points
ID: 24947766
Never did get this one going, and the project has ended.  Closing...
0

Featured Post

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Prologue It is often required to host multiple websites on a single instance of IIS, mostly in development environments instead of on production servers. I am sure it is not much a preferred solution on production servers but this is at least a pos…
A phishing scam that claims a recipient’s credit card details have been “suspended” is the latest trend in spoof emails.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

785 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question