IIS Recycle Application Pool By A Non-Admin User

Adrian Jenkins
3 min readOct 5, 2022

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:

  • VM “Test01” => from where we are going to use “msdeploy.exe” and recycle an ApplicationPool from “Test2”.
  • VM “Test2”.
  • Both VM’s must have Management Service role installed (Web Server (IIS) > Management Tools >Management Service).
  • Both VM’s must have Web Deploy (3.6) installed. We could go for a higher version but ensure both have the same version.

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:

--

--