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.
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.

Thanks for this article! I was getting stuck with the pkgmgr not installing. Your tip about changing the assemblyIdentity version did the trick. Thanks again!!
Can you change the IIS 7 destination path where it will get installed to? You could on IIS 6.
John: By destination path do you mean the inetsrv path, by default C:\windows\system32\inetsrv?
I would like to have Inetpub on the E: drive, not C.
With IIS 6 the .inf file I used
[InternetServer]
PathWWWRoot = e:\InetPub\Wwwroot
Thanks
John: Ok, I see what you mean now. I did a quick Google search and one of the responses I found to someone else asking the same question is as follows (it appears to be from someone involved with the IIS design process at Microsoft):
Open %windir%\system32\inetsrv\config\applicationhost.config and search for
%SystemDrive%\inetpub\wwwroot
Change the path.
Or do an %windir%\system32\inetsrv\appcmd list vdir
and to change the path execute
%windir%\system32\inetsrv\appcmd set vdir “Default Web Site/” -physicalPath:
Does that do what you want? Sorry I haven’t had a chance to try it myself yet.