Saturday, May 14, 2011

Check and get list of existing AppPools and Websites on a machine for IIS 7.0


I have been using Installshield for so long, but tasks related to IIS 7.0 found to be most amazing, as it make me learn about IIS quite a lot. I got introduced with AppCmd.exe which is a single command line tool for managing IIS 7. AppCmd enables us to easily control the server without using a graphical administration tool and to quickly automate server management tasks without writing code.

Some of the things you can do with AppCmd:

  1. Create and configure sites, apps, application pools, and virtual directories
  2. Start and stop sites, and recycle application pools
  3. List running worker processes, and examine currently executing requests
  4. Search, manipulate, export, and import IIS and ASP.NET configuration

I had a requirement in one of my web project, for showing users a list of available App Pools and Web-sites for selection. Using vb-script found to be little uncomfortable, but AppCmd.exe makes my life easy.

Note: AppCmd.exe is located in the %systemroot%\system32\inetsrv\ directory. Because it is not path of the PATH automatically, you need to use the full path to the executable when executing commands like in "%systemroot%\system32\inetsrv\AppCmd.exe list sites". Alternatively, you can manually add the inetsrv directory to the path on your machine so that you can access AppCmd.exe directly from any location.

List of App Pools can be get by using command: "AppCmd.exe list apppool".







Similarly we can get the list of available websites: "AppCmd.exe list site".

We can take the output of the above commands in a text file, and can read the AppPool list. Similary we can do for Website.

3 comments:

  1. Thank you for this...... this information helped me

    ReplyDelete
  2. Thanks For sharing this Superb article.I use this Article to show my assignment in college.it is useful For me Great Work. horseshoe bay custom pool construction

    ReplyDelete
  3. It is an excellent blog, I have ever seen. I found all the material on this blog utmost unique and well written. And, I have decided to visit it again and again. spicewood tx custom pool builder

    ReplyDelete