Windows

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.

9 comments
TimOwinner
TimOwinner

With Windows Web Server 2008, we have greatly expanded the capabilities of this Windows SKU based on customer feedback about Windows Server 2003 Web Edition. We have enhanced the supported hardware configurations supporting up to 4 sockets and up to 32GB of RAM on x64 installations, exactly the same as Windows standard server. In addition to the expanded hardware configurations we also support Windows SharePoint Services, Windows Media Services and SQL Server installations for use with local web applications. The new Windows Web Server 2008 also supports the server core installation option. Learn more information about Windows Web Server 2008 storage management and disk backup, please refer to http://www.disk-partition.com/res/Windows-Server-2008-Partition.html and http://www.disk-partition.com/backupper/excellent-system-backup-freeware.html

taba469
taba469

What changes to this script would be necessary if one wanted to install the "inetpub" directory to a drive over than "C"?

dodoman91
dodoman91

Thnx for the script, very useful. Good article.

bblackmoor
bblackmoor

"...many products require the IIS Web engine as a prerequisite..." Any product that requires IIS is a product to avoid.

kdpawson
kdpawson

You can also use the ServerManagerCmd utility. Example: ServerManagerCmd -i RSAT-ADDS ServerManagerCmd -i Web-Metabase ServerManagerCmd -i Web-Lgcy-Mgmt-Console ServerManagerCmd -i Web-Server ServerManagerCmd -i Web-ISAPI-Ext ServerManagerCmd -i Web-Lgcy-Mgmt-Console ServerManagerCmd -i Web-Basic-Auth ServerManagerCmd -i Web-Digest-Auth ServerManagerCmd -i Web-Windows-Auth ServerManagerCmd -i Web-Dyn-Compression ServerManagerCmd -i RPC-over-HTTP-proxy See: http://technet.microsoft.com/en-us/library/cc748918.aspx

lcashion
lcashion

When you are in a business where 90% of the vendors out there are staffed wiht Business people that learned development, as opposed to the other way around, you have no choice.

b4real
b4real

Performance Point, SQL Server, many 3rd party products.

joe
joe

I dont see why anyone would want to run IIS in the first place. hosting your own website is madness. anyone can easily afford to use a hosting service or lease a web server. either way, running linux and apache = no worries!

Timothy J. Bruce
Timothy J. Bruce

For external facing websites, outsourcing hosting may be a better solution. Frequent patching, security vulnerabilities, firewall management and network routing require more experienced and knowledgeable employees. However, many applications now use a web interface for management and may require IIS (and not Apache, unfortunately) to be installed and configured in order to use the application. This isn't my call, but it is something I'm noticing more and more as we bring in new applications for OUR environment. (They also bring in embedded databases that bring their own problems....) Tim kb0odu

Editor's Picks