Configuring Remote Execute Action to Restart IIS Application Pools in Applications Manager

This KB contains the steps to configure remote action for restarting IIS Application Pools in Applications Manager.
- Extract the attached 'RestartIISAppPools.zip' file on the remote server.
- Ensure the extracted file is placed in an accessible location on the remote server.
- Copy the absolute path of the extracted file. (Ex: C:\Users\Administrator\RestartIISAppPools.bat)
- This path will be used in step 4.d while configuring the execution action.
- Open the batch file and replace 'DefaultAppPool' with the specific IIS app pool name that needs to be restarted.
- Go to Applications Manager, click on Actions (
) drop down under the navigation menu and click on Execute Program (
) and follow the steps below:
- Specify the Display Name (Ex: Restart App Pools).
- Script Location: Remote Server
- Target Hosts: Add a new host or choose existing one.
Ensure the user used to add the host have enough privilege to restart the Application Pools.- Program To Execute: Absolute path copied in step 2.
- Directory to execute Program: C:\ or the path to execute the program.
- Configure Success notification or Failure notification as per the need.
- Click Create Action (
) button.
Verify if an Application Pool is restarted
To check whether the IIS Application Pool has restarted, run the following PowerShell command.

Get-WinEvent -LogName System | Where-Object {$_.Message -like "recycle*"}
Command used
Use the following appcmd command to restart an IIS Application Pool. Replace <APP_POOL_NAME> with the required application pool name (Ex: DefaultAppPool).
To restart single application pool:

appcmd recycle apppool /apppool.name:<APP_POOL_NAME>
To restart multiple application pool: (Edit and append the lines in the extracted bat file)

appcmd recycle apppool /apppool.name:<APP_POOL_1_NAME>
appcmd recycle apppool /apppool.name:<APP_POOL_2_NAME>
...........
appcmd recycle apppool /apppool.name:<APP_POOL_N_NAME>

If the appcmd path is not set in the environment variable, navigate to %windir%\system32\inetsrv to execute the command.
New to ADSelfService Plus?