IIS Recycle Application Pool By A Non-Admin User

Recycling an Application Pool is an action that only should be performed by admins. However, here is a way to recycle an Application Pool by a non-admin user.

Environment:

You must ensure Management Service is started. Here you can configure access to specific IP, users or IIS Manager credentials. I will leave it as default that will accept all clients.

Now we need to grant site access to the user that will perform this action.

In this “Test02” I have created a user called “userTest2”

Let us say we need to recycle the Application Pool of “Default Web Site”.

Go to this site, “IIS Manager Permissions” and, add the user.

Switch over to “Test01”, open cmd and “cd” into where the executable of Web Deploy is:

“C:\Program Files (x86)\IIS\Microsoft Web Deploy V3”

Stop command:

msdeploy -verb:sync -source:recycleApp -dest:recycleApp=”Site_Name”,recycleMode=”StopAppPool”,wmsvc=Server_Name,userName=<<username>>,password=<<password>> -allowuntrusted

Output:

C:\Program Files (x86)\IIS\Microsoft Web Deploy V3>msdeploy -verb:sync -source:recycleApp -dest:recycleApp=”Default Web Site”,recycleMode=”StopAppPool”,wmsvc=Test2,userName=userTest2,password=PASSWORD -allowuntrusted
Info: Using ID ‘8323fd4c-368b-4f6b-9c84–4cc3bd6a404a’ for connections to the remote server.
Info: Updating recycleApp (Default Web Site).
Total changes: 1 (0 added, 0 deleted, 1 updated, 0 parameters changed, 0 bytes copied)

Application Pool from “Test2” stopped:

Start command:

msdeploy -verb:sync -source:recycleApp -dest:recycleApp="Site_Name",recycleMode="StartAppPool",wmsvc=server_Name,userName=<<username>>,password=<<password>> -allowuntrusted

Output:

C:\Program Files (x86)\IIS\Microsoft Web Deploy V3>msdeploy -verb:sync -source:recycleApp -dest:recycleApp="Default Web Site",recycleMode="StartAppPool",wmsvc=Test2,userName=userTest2,password=PASSWORD-allowuntrusted
Info: Using ID '863a1c3c-36aa-4850-ae37-8077e198a32a' for connections to the remote server.
Info: Updating recycleApp (Default Web Site).
Total changes: 1 (0 added, 0 deleted, 1 updated, 0 parameters changed, 0 bytes copied)

Application Pool started:

Resources:

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store