How to Issue "iisreset" command from ASP page

Posted on 2009-05-07
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

Question by:sarg_man
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
LVL 23

Expert Comment

by:Saqib Khan
ID: 24330659
LVL 13

Expert Comment

by:Praveen DM
ID: 24379585
give access to the IUSR_sitemachine name on CMD and then give a try...
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"
Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

LVL 13

Expert Comment

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

Author Comment

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.
LVL 13

Expert Comment

by:Praveen DM
ID: 24399638

Accepted Solution

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

Featured Post

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

This demonstration started out as a follow up to some recently posted questions on the subject of logging in: and…
Introduction This article explores the design of a cache system that can improve the performance of a web site or web application.  The assumption is that the web site has many more “read” operations than “write” operations (this is commonly the ca…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

628 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