Solved

How to Issue "iisreset" command from ASP page

Posted on 2009-05-07
7
3,090 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
[X]
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
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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
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

Business Impact of IT Communications

What are the business impacts of how well businesses communicate during an IT incident? Targeting, speed, and transparency all matter. Find out more in this infographic.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Problem to copy file 14 89
BIG DATA Question: Path to migrate current "Document Management" system 13 71
Validating number not work with decimal 4 46
Add Rows on a Table 8 52
Article by: kevp75
Hey folks, 'bout time for me to come around with a little tip. Thanks to IIS 7.5 Extensions and Microsoft (well... really Windows 8, and IIS 8 I guess...), we can now prime our Application Pools, when IIS starts. Now, though it would be nice t…
Periodically we have to update or add SSL certificates for customers. Depending upon your hosting plan you may be responsible for the installation and/or key generation. In the wake of Heartbleed many sites were forced to re-key. We will concen…

738 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