Using Unattended Setup to Install IIS 7.0
by Tobin Titus
Introduction
Pkgmgr.exe is a new command tool in Windows Vista/Windows Server® 2008 for installing Windows Optional Features:
- Replaces sysocmgr.exe for installing Windows Optional Features
- Allows you to install / un-install Windows Vista Optional Features directly from command prompt or from scripts
Pkgmgr can take a list of windows features to install on the command line or take an xml file name as a parameter for unattend installs. This article will illustrate the use of pkgmgr unattend files for installing optional features.
Prerequisites
Windows Vista/Windows Server 2008 Editions Supported
This walkthrough is for the following editions of Windows Vista/Windows Server 2008:
- Windows Vista Home Premium Edition
- Windows Vista Professional Edition
- Windows Vista Ultimate Edition
- Windows Server 2008 Editions
Make sure you have installed one of the supported editions of Windows Vista/Windows Server 2008 before proceeding.
Local User Administrator (LUA) Security
Make sure you have administrative privileges on the machine: By default, you do not have them if you are logged on as a user other than the built-in Administrator account, even if this user was added to the local Administrators group on the machine (this is a new security feature in Windows Server 2008, called LUA, which is beyond the scope of this article). Make sure to either log-on as the built-in Administrator account, or explicitly invoke applications as the built-in Administrator, as needed, using the "runas" cmd-line tool.
For example, to launch notepad.exe, run this command: "runas /user:administrator notepad.exe". You are prompted for the password of the Administrator account. It is useful to have a cmd-box shell that is already elevated, by running "runas /user:administrator cmd.exe". Every application you run from that cmd-box is elevated as well, and you do not need to use the "runas" syntax from that cmd-box.
Procedure
Step 1: Pkgmgr.exe Overview
Windows Optional features in Vista/Windows Server 2008 is installed using a new command tool called Pkgmgr. The command line syntax using pkgmgr.exe is:
Start /w pkgmgr.exe /iu:update1;update2…
Pkgmgr.exe Commands
/iu:{update name};
This specifies updates to install by update name and takes a semicolon separated name of updates to install.
/uu:{update name};
This specifies the updates to uninstall and takes a semicolon separated list of selectable updates to be uninstalled from the system. At least one update name must be specified
/n:{unattend XML}
This specifies file name of the unattend XML file.
Note
If you run pkgmgr without the "start /w" prefix, the pkgmgr cmd will return immediately and you will not know when the optional feature install has completed.
Step 2: Open Command Window
Follow the instructions in the Prerequisites section above for starting a command window running as the local Administrator account.
Step 3: Create an Unattend.xml file
From the command window, run notepad.exe.
To install only the IIS 7.0 default features, copy the following unattend.xml text into notepad.
<?xml version="1.0" ?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<servicing>
<!-- Install a selectable update in a package that is in the Windows Foundation namespace -->
<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>
If you want to install all IIS 7.0 features for evaluation purposes, use one of the following unattend.xml files.
For Windows Vista Professional, Windows Vista Ultimate, or Windows Server 2008 Editions, copy and paste the following text into notepad.
<?xml version="1.0" ?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<servicing>
<!-- Install a selectable update in a package that is in the Windows Foundation namespace -->
<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="IIS-WebServer" state="true"/>
<selection name="IIS-CommonHttpFeatures" state="true"/>
<selection name="IIS-StaticContent" state="true"/>
<selection name="IIS-DefaultDocument" state="true"/>
<selection name="IIS-DirectoryBrowsing" state="true"/>
<selection name="IIS-HttpErrors" state="true"/>
<selection name="IIS-HttpRedirect" state="true"/>
<selection name="IIS-ApplicationDevelopment" state="true"/>
<selection name="IIS-ASPNET" state="true"/>
<selection name="IIS-NetFxExtensibility" state="true"/>
<selection name="IIS-ASP" state="true"/>
<selection name="IIS-CGI" state="true"/>
<selection name="IIS-ISAPIExtensions" state="true"/>
<selection name="IIS-ISAPIFilter" state="true"/>
<selection name="IIS-ServerSideIncludes" state="true"/>
<selection name="IIS-HealthAndDiagnostics" state="true"/>
<selection name="IIS-HttpLogging" state="true"/>
<selection name="IIS-LoggingLibraries" state="true"/>
<selection name="IIS-RequestMonitor" state="true"/>
<selection name="IIS-HttpTracing" state="true"/>
<selection name="IIS-CustomLogging" state="true"/>
<selection name="IIS-ODBCLogging" state="true"/>
<selection name="IIS-Security" state="true"/>
<selection name="IIS-BasicAuthentication" state="true"/>
<selection name="IIS-WindowsAuthentication" state="true"/>
<selection name="IIS-DigestAuthentication" state="true"/>
<selection name="IIS-ClientCertificateMappingAuthentication" state="true"/>
<selection name="IIS-IISCertificateMappingAuthentication" state="true"/>
<selection name="IIS-URLAuthorization" state="true"/>
<selection name="IIS-RequestFiltering" state="true"/>
<selection name="IIS-IPSecurity" state="true"/>
<selection name="IIS-Performance" state="true"/>
<selection name="IIS-HttpCompressionStatic" state="true"/>
<selection name="IIS-HttpCompressionDynamic" state="true"/>
<selection name="IIS-WebServerManagementTools" state="true"/>
<selection name="IIS-ManagementConsole" state="true"/>
<selection name="IIS-ManagementScriptingTools" state="true"/>
<selection name="IIS-ManagementService" state="true"/>
<selection name="IIS-IIS6ManagementCompatibility" state="true"/>
<selection name="IIS-Metabase" state="true"/>
<selection name="IIS-WMICompatibility" state="true"/>
<selection name="IIS-LegacyScripts" state="true"/>
<selection name="IIS-LegacySnapIn" state="true"/>
<selection name="IIS-FTPPublishingService" state="true"/>
<selection name="IIS-FTPServer" state="true"/>
<selection name="IIS-FTPManagement" 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>
If you are installing IIS 7.0 on Windows Vista Home Premium, copy and paste the following text into notepad:
<?xml version="1.0" ?>
<unattend xmlns="urn:schemas-microsoft-com:unattend"
xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State">
<servicing>
<!-- Install a selectable update in a package that is in the Windows Foundation namespace -->
<package action="configure">
<assemblyIdentity
name="Microsoft-Windows-Foundation-Package"
version="6.0.5303.0"
language="neutral"
processorArchitecture="x86"
publicKeyToken="31bf3856ad364e35"
versionScope="nonSxS"
/>
<selection name="IIS-WebServerRole" state="true"/>
<selection name="IIS-WebServer" state="true"/>
<selection name="IIS-CommonHttpFeatures" state="true"/>
<selection name="IIS-StaticContent" state="true"/>
<selection name="IIS-DefaultDocument" state="true"/>
<selection name="IIS-DirectoryBrowsing" state="true"/>
<selection name="IIS-HttpErrors" state="true"/>
<selection name="IIS-HttpRedirect" state="true"/>
<selection name="IIS-ApplicationDevelopment" state="true"/>
<selection name="IIS-ASPNET" state="true"/>
<selection name="IIS-NetFxExtensibility" state="true"/>
<selection name="IIS-ASP" state="true"/>
<selection name="IIS-CGI" state="true"/>
<selection name="IIS-ISAPIExtensions" state="true"/>
<selection name="IIS-ISAPIFilter" state="true"/>
<selection name="IIS-ServerSideIncludes" state="true"/>
<selection name="IIS-HealthAndDiagnostics" state="true"/>
<selection name="IIS-HttpLogging" state="true"/>
<selection name="IIS-LoggingLibraries" state="true"/>
<selection name="IIS-RequestMonitor" state="true"/>
<selection name="IIS-HttpTracing" state="true"/>
<selection name="IIS-CustomLogging" state="true"/>
<selection name="IIS-ODBCLogging" state="true"/>
<selection name="IIS-Security" state="true"/>
<selection name="IIS-BasicAuthentication" state="true"/>
<selection name="IIS-URLAuthorization" state="true"/>
<selection name="IIS-RequestFiltering" state="true"/>
<selection name="IIS-IPSecurity" state="true"/>
<selection name="IIS-Performance" state="true"/>
<selection name="IIS-HttpCompressionStatic" state="true"/>
<selection name="IIS-HttpCompressionDynamic" state="true"/>
<selection name="IIS-WebServerManagementTools" state="true"/>
<selection name="IIS-ManagementConsole" state="true"/>
<selection name="IIS-ManagementScriptingTools" state="true"/>
<selection name="IIS-ManagementService" state="true"/>
<selection name="IIS-IIS6ManagementCompatibility" state="true"/>
<selection name="IIS-Metabase" state="true"/>
<selection name="IIS-WMICompatibility" state="true"/>
<selection name="IIS-LegacyScripts" state="true"/>
<selection name="IIS-LegacySnapIn" 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>
Step 4: Get Windows Build Number
You then must check the version number of Windows you have installed. To find the exact version, do the following:
From the Start Menu, click Run and go into the explorer.
In your notepad, enter this value in the XML attribute version to match the build you have installed.
In this case, version="6.0.5308.6"
If you have installed on a 64 Bit CPU you must edit the processorArchitecture XML attribute:
processorArchitecture="amd64"
Note
Possible values are: x86, amd64, and ia64.
Step 5: Save the Unattend.xml File
Save the notepad file with name "unattend.xml"
Step 6: Run Pkgmgr with the Unattend.xml File
In the command window, enter the following command line:
start /w pkgmgr /n:unattend.xml
Note: If you saved unattend.xml to a drive folder other then the current drive and folder of your command window, you must specify the full path of the unattend.xml file in your pkgmgr /n: parameter.
Step 7: Wait for Setup to Complete
IIS 7.0 setup via pkgmgr.exe should take 1 to 5 minutes. When the command prompt returns, IIS 7.0 setup is complete.
Step 8: Check Error Code
At the command prompt type:
echo %errorlevel%
A result of 0 indicates success.
Summary
In this article, we examined how to use pckmgr.exe to install the Operating System and IIS 7.0.