You can usually add features through the Windows Server 2008 Server Manager snap-in via a script. In the case of IIS 7.0, there are many options available for the feature install.

One way to ensure a consistent configuration for applications that require IIS (e.g., SQL Server) is to use a scripted installation. For IIS, the package manager can install the features locally. To install a basic IIS configuration, run the following script:

start /w pkgmgr /iu:IIS-WebServerRole;IIS-WebServerManagementTools;



The command provides little interaction and, by default, does not provide feedback of any type if an incorrect parameter is passed after the /iu parameter. Figure A shows IIS being added via the script.
Figure A

Once the scripted task completes after a minute or so, and the Window Server 2008 Server Manager snap-in performs its next refresh, the Web server is listed as a role on the system and is running. Figure B shows an updated Server Manager snap-in with this basic IIS role.
Figure B

Using this scripted install of IIS is a good way to ensure consistent server build configurations, and other Windows features can be automated through the package manager (pkgmgr). The package manager can also uninstall packages, which may be helpful for temporarily enabling a feature for a specified amount of time and for removing the feature from a scheduled task to ensure its decommissioning.

For more information on the package manager, read the TechNet article Package Manager Command-Line Options.

Stay on top of the latest Windows Server 2003 and Windows Server 2008 tips and tricks with our free Windows Server newsletter, delivered each Wednesday. Automatically sign up today!