Quickest way to run IISRESET as administrator

3

Trying to optimize my day here, making do with IIS...

When executing IISRESET from the Run dialog or from cmd.exe, I get an access denied error. So executing IISRESET gets annoying - involving both mouse and keyboard:

  1. Start -> Run -> cmd (right-click, Run as Administrator)
  2. Agree to the UAC dialog
  3. Type iisreset, hit enter

I'm looking to be able to run IISRESET as quickly as possible. Ideally I could just go Start -> Run -> iisreset -> Enter, and the UAC prompt would pop up. I tried to enable "Run this program as an Administrator" but it was greyed out, even when I opened the properties dialog as NT AUTHORITY\SYSTEM.

Thinking of making a Visual Studio macro and a toolbar button; anyone got any other ideas?

Chris Adams

Posted 2012-12-07T03:39:43.923

Reputation: 283

Answers

4

Eureka!

Add this string value to the registry, without the quotes:

HKEY_CURRENT_USERS\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags\Layers "c:\windows\system32\iisreset.exe" = "RUNASADMIN"

Interestingly the same key is ignored if it's under HKEY_LOCAL_MACHINE. Looks to me like a security flaw...

Chris Adams

Posted 2012-12-07T03:39:43.923

Reputation: 283

I use Windows 10 and can't find such registry :( Any advice please? – Gondil – 2017-06-01T11:14:57.937

The same trick can be done for explorer.exe which will give you admin access to your entire system! Fun.. – Chris Adams – 2012-12-07T03:57:55.210

1

Windows 10

  1. Open the command prompt or any other app you need permanent admin access
  2. Right click on Icon that has appeared on the Windows 10 bar at the bottom
  3. Right click on the app icon in the list
  4. Choose properties
  5. Click Advanced
  6. Check the Run as Administrator checkbox
  7. Save and close all the opened dialogs

Now every time you open the app again it will be running in admin mode.

Andrew Marais

Posted 2012-12-07T03:39:43.923

Reputation: 111