There’s not a lot of point having an article on this site about how to perform an unattended installation of IIS6 (Windows XP & Windows Server 2003) and ignore IIS7 (Windows Server 2008 & Windows Vista). So, here’s the article about how to perform an unattended installation of IIS7. Ready?

Firstly, you can’t follow the steps in this article if you’re trying to do an unattended installation of IIS6 on Windows Server 2003. Instead, follow my article entitled How to perform an unattended installation of IIS6.

The unattended installation of IIS7 is similar to an unattended installation of IIS6 in only one major way – you still need an answer file. However, that’s really where the similarity ends. For a start, the answer file is now an XML file, not an INF file. The old installation program, Sysocmgr.exe, has now been replaced with PkgMgr.exe as well as a couple of other command-line tools like ServerManagerCmd.exe (VERY useful – I’ll post about it when I can).

There are a couple of things to note when doing unattended installations of IIS7 on Windows Vista and Windows Server 2008. Firstly, Windows Vista Ultimate, Windows Vista Professional and Windows Server 2008 (Longhorn) have different options available for use in the answer file than Windows Vista Home Premium. Also, you’ll need to get the build number of your system before you create the answer file. To do this, follow the steps below.

1. Click Start and type "explorer.exe" into the Start Search box.
2. When explorer.exe is found, don’t click it. If explorer.exe isn’t found … well … I doubt you’ll be worrying about reading this. :)
3. RIGHT-click explorer.exe, select Properties and go to the Details tab. Note down the details next to Product Version – you’ll need it shortly. See below:

Ok so now that you’ve got your system’s build number you can start creating the XML answer file. There’s a couple of examples floating around the web that are far better than any custom examples I could ever create so I’ve made them downloadable below. The XML answer file immediately below this paragraph will work on Windows Vista Ultimate, Windows Vista Professional, Windows Vista Home Premium and Windows Server 2008 (Longhorn) and will install IIS7 in the default configuration with no user customisations.

<?xml version="1.0" ?> <unattend xmlns="urn:schemas-microsoft-com:unattend" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State"> <servicing> <package action="configure"> <assemblyIdentity name="Microsoft-Windows-Foundation-Package" version="6.0.5308.6" language="neutral" processorArchitecture="x86" publicKeyToken="31bf3856ad364e35" versionScope="nonSxS" /> <selection name="IIS-WebServerRole" state="true"/> <selection name="WAS-WindowsActivationService" state="true"/> <selection name="WAS-ProcessModel" state="true"/> <selection name="WAS-NetFxEnvironment" state="true"/> <selection name="WAS-ConfigurationAPI" state="true"/> </package> </servicing> </unattend>

Before using the file above or any of the files linked below you’ll need to make 2 changes.

1. Change the assemblyIdentity version to the version you found by getting the properties of explorer.exe earlier in this article. If you don’t do this the PkgMgr.exe program will start and then drop immediately back to the command prompt without installing anything.
2. Change the assemblyIdentity processor architecture to match your system. Possible values are x86, amd64 and ia64.

If you want to install ALL components, choose one of the files from the links below.
» Windows Vista Ultimate, Windows Vista Professional & Windows Server 2008 (Longhorn)
» Windows Vista Home Premium

And here is my IIS7 unattended answer file. It is a default IIS7 installation with a few customisations, e.g. ASP.NET etc.
» My IIS7 unattended answer file for Windows Vista Ultimate/Professional/Windows Server 2008 (it has a few customisations)

Some articles will tell you the answer file needs to be called "unattend.xml" – it doesn’t. You can name it whatever you want (my production one is called iis7-unattended.xml).

Once you’ve got the answer file sorted you need to actually do the install. Open a command prompt AS ADMINISTRATOR (that part is important – right click the shortcut and click "Run as administrator"). If you have UAC enabled confirm that you want to perform the requested action then run the following command. Make sure you change the values to match those on your system, i.e. paths and filenames.

start /w C:\Windows\System32\PkgMgr.exe /n:C:\Scripts\iis7-unattended.xml

The installation will take a few minutes depending on your system’s configuration and performance. Once the command prompt returns (the /w parameter will cause the window to wait until the installation has finished before you can use it again) you can browse to http://localhost and see the default IIS7 page that should look something like the screenshot below.

  • Share/Save/Bookmark

Related posts:

  1. How to perform an unattended installation of SQL Server 2008 Express A while ag
  2. Follow up – How to perform an unattended installation of the .NET Framework 2.0 Some time
  3. Follow Up – Post-build Windows unattended installation script Back in Ju
  4. How to perform an unattended installation of the .NET Framework 3.5 w/ SP1 This post
  5. SQL Server 2005 Express Unattended Install – Further Info Recently I

Related posts brought to you by Yet Another Related Posts Plugin.

Tags: , , , , , , , , , , ,