Microsoft

Installing a simple Web server on Windows Server 2008 from a script

While there are more advanced Web server configurations, many products require the IIS Web engine as a prerequisite. Here's how to install a simple IIS Web server through a scripted role.

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;

IIS-ManagementService;IIS-Metabase;WAS-WindowsActivationService;

WAS-ProcessModel;WAS-NetFxEnvironment;WAS-ConfigurationAPI
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

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

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!

About

Rick Vanover is a software strategy specialist for Veeam Software, based in Columbus, Ohio. Rick has years of IT experience and focuses on virtualization, Windows-based server administration, and system hardware.

Editor's Picks