Something I’ve found to be essential for anyone that works in a support role within the IT field is to have standards in place across your environments. When troubleshooting an issue it makes things much easier to know exactly what options and configurations are on your server, otherwise you’re wasting precious time investigating rather than reacting. Keeping with this theme I thought I would share some of the steps I follow when deploying a standard build to an IIS 7 web server. Automating this process through the command line rather than manually performing the install through the GUI not only makes installing IIS incredibly easy, it ensures that your standards will be followed every time no matter who is performing the install.
The automated process for IIS 7 is quite different than it was in IIS 6. I actually prefer how it was done in the previous version but I’m slowly getting over it. If anyone is interested I can write up an article for 6 as well, but I figured IIS 7 installs would be a lot more common these days. I’ve found the easiest method in the new version is to use ServerManagercmd.exe, the new command line configuration tool for Windows Server 2008. I learned at TechEd that this is also the way the Microsoft.com team performs their IIS 7 installs.
You can read up on the use of ServerManagercmd, but using it is extremely simple. To install a very basic web server that will serve static content, run the following from a command prompt:
ServerManagerCMD.exe –I Web-Server
For a full install, which I would HIGHLY recommend AGAINST doing in a production environment, run the following command:
ServerManagerCMD.exe –I Web-Server –allsubfeatures
Personally in my standard build scripts I individually list the exact features that I know I need. This results in a web server that contains everything I need, and nothing that I don’t. This not only makes management easier, it reduces your attack surface which is always a good idea.
Here is the command that I use:
ServerManagerCmd.exe -i Web-Server Web-Common-Http Web-Http-Redirect Web-Asp-Net Web-Net-Ext Web-ASP Web-ISAPI-Ext Web-ISAPI-Filter Web-Http-Logging Web-Log-Libraries Web-Request-Monitor Web-Http-Tracing Web-Filtering Web-Stat-Compression Web-Dyn-Compression Web-Mgmt-Console Web-Scripting-Tools Web-Mgmt-Service Web-Windows-Auth WAS
To read more about the different features of IIS 7 and determine which components are needed in your environment you can refer to this handy Technet page.
For my standard web server builds, I’ll put the above ServerManagercmd command in a batch file and also include some lines to create our standard folder structure. You can also include some customized settings for your web servers in your batch file, here are a couple that I configure using appcmd:
Set the default value for application pools to recycle at 1:00 AM:
appcmd.exe set config -section:system.applicationHost/applicationPools /+”[name='DefaultAppPool'].recycling.periodicRestart.schedule.[value='01:00:00']” /commit:apphost
Log all recycle events to the event log:
appcmd.exe set config -section:system.applicationHost/applicationPools /[name='DefaultAppPool'].recycling.logEventOnRecycle:”Time, Requests, Schedule, Memory, IsapiUnhealthy, OnDemand, ConfigChange, PrivateMemory” /commit:apphost
The possibilities are really endless here, so if there is a specific setting that you prefer across all of your web servers, go ahead and include it in your standard build so that you know it’s always configured no matter which server you are on. The IIS team has created an awesome tool called Configuration Editor which will assist you with creating the commands for just about any change you can make in IIS 7.
Congratulations, you now know how to perform an automated install of IIS 7! Look out for my next article in the coming days where I’ll explain how to “install” IIS 7 to a non-system drive. And yes install is in quotes for a very good reason. :)
Similar Articles:

0 Comments For This Post
2 Trackbacks For This Post
January 21st, 2009 at 10:49 PM
[...] HOW TO: Perform An IIS 7 Automated Install [...]
January 28th, 2009 at 3:31 PM
[...] my previous article we discussed how to perform an automated install of IIS 7 and how to use ServerManagercmd and [...]
Leave a Reply
You must be logged in to post a comment.