Solved

How to Issue "iisreset" command from ASP page

Posted on 2009-05-07
7
3,058 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:adilkhan
ID: 24330659
0
 
LVL 13

Expert Comment

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

Expert Comment

by:adilkhan
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
Free Gift Card with Acronis Backup Purchase!

Backup any data in any location: local and remote systems, physical and virtual servers, private and public clouds, Macs and PCs, tablets and mobile devices, & more! For limited time only, buy any Acronis backup products and get a FREE Amazon/Best Buy gift card worth up to $200!

 
LVL 13

Expert Comment

by:servoadmin
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:servoadmin
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

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Join & Write a Comment

I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

747 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now