RepackagingWeb TechnologiesWindows Technologies

Automating IIS Web tasks using AppCmd command


You need to automate the management like create, start, stop, etc., of IIS Resources including Web Site, App, AppPool, etc.


Microsoft provides a command line tool named Appcmd.exe which ships/installs along with IIS.  It’s usually located at C:\WINDOWS\system32\inetsrv\appcmd.exe path.

Automation Examples:

  • Create an APPPOOL, with specified name, .Net Framework version, Managed pipeline mode, etc.,

C:\>C:\WINDOWS\system32\inetsrv\appcmd.exe ADD APPPOOL /name:TestAppPool /managedRuntimeVersion:v4.0 /managedPipelineMode:”Integrated”

APPPOOL object “TestAppPool” added


  • Stop an APPPOOL

PS C:\> C:\WINDOWS\system32\inetsrv\appcmd.exe STOP APPPOOL TestAppPool

“TestAppPool” successfully stopped

PS C:\>

  • Start an APPPOOL

PS C:\> C:\WINDOWS\system32\inetsrv\appcmd.exe START APPPOOL TestAppPool

“TestAppPool” successfully started.

PS C:\>

  • Create a web Application under the Default Web Site,  with name as “TestApp”, with physical path located at “C:\inetpub\wwwroot\TestApp” and assign it to “TestAppPool” AppPool

C:\>C:\WINDOWS\system32\inetsrv\appcmd.exe ADD APP /”Default Web Site” /path:/TestApp /physicalPath:C:\inetpub\wwwroot\TestApp /applicationPool:TestAppPool
APP object “Default Web Site/TestApp” added
VDIR object “Default Web Site/TestApp” added



Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.