Useful appcmd commands

So with IIS7, there is a new way to get data out about your web server, using the new appcmd.exe process.

To start out with, the best place to start is with: Things you can do by piping appcmd commands

There are a lot of useful commands listed there that can start you moving ahead. If you want to see the full documentation, take a look at:

Getting Started with AppCmd.exe

Combining this with Powershell can we a really powerful idea. We can use a lot of different things to create some really powerful commands. The first one that I wanted to do is to iterate through all the applications in a given site and get the folders on disk. This can then be passed to a dir command to search for web.config files. This is useful for gathering all web.config files in the case of support. Or making sure you have things set correctly in all of them. The command is:

 appcmd list app /site.name:"Default Web Site" 
/xml | appcmd list vdir /in /text:physicalPath

This will give a listing of directories which we can then run our DIR command against. I have tried to pass our data to DIR, but I couldn’t figure out a way to get it to work.

There is a lot of documentation on this out there already. Here are some additional links:

kick it on DotNetKicks.com