無人セットアップを使用した IIS 7.0 のインストール

作成者: Tobin Titus

はじめに

Pkgmgr.exe は、Windows オプション機能をインストールするための Windows Vista/Windows Server ® 2008 での新しいコマンド ツールです:

  • Windows オプション機能をインストールするためのsysocmgr.exe を置き換えます
  • コマンド プロンプトまたはスクリプトから Windows Vista のオプション機能を直接インストール/アンイストールできます

Pkgmgr は、コマンド ラインにインストールする Windows 機能の一覧を取得し、無人インストールのパラメーターとして xml ファイル名を取得することができます。 この記事では、オプション機能をインストールするための pkgmgr 無人セットアップ ファイルの使用について説明します。

前提条件

サポートされている Windows Vista/Windows Server 2008 のエディション

このチュートリアルは、Windows Vista/Windows Server 2008 の次のエディションを対象としています:

  • Windows Vista Home Premium Edition
  • Windows Vista Professional Edition
  • Windows Vista Ultimate Edition
  • Windows Server 2008 Editions

先に進む前に、サポートされている Windows Vista/Windows Server 2008 のいずれかのエディションがインストールされていることを確認してください。

ローカル ユーザー管理者 (LUA) のセキュリティ

マシンに対する管理特権があることを確認します。既定では、あらかじめ登録された Administrator アカウント以外のユーザーとしてログオンしている場合、このユーザーがマシン上のローカル Administrators グループに追加されている場合でも、管理特権はありません (これは、IIS を使用する Windows Server 2008 の新しいセキュリティ機能であり、LUA と呼ばれますが、この記事の範囲を超えています)。 あらかじめ登録された Administrator アカウントととしてログオンするか、必要に応じて "runas" コマンド ライン ツールを使用し、ビルトイン Administrator としてアプリケーションを明示的に呼び出してください。

たとえば、notepad.exe を起動するには、"runas /user:administrator notepad.exe" コマンドを実行します。 Administrator アカウントのパスワードの入力を求めるメッセージが表示されます。 "runas /user:administrator cmd.exe" を実行して、既に昇格している cmd-box シェルを用意しておくと便利です。 その cmd-box から実行するすべてのアプリケーションも同様に昇格するため、その cmd-box から "runas" 構文を使用する必要はありません。

プロシージャ

手順 1: Pkgmgr.exeの概要

Vista/Windows Server 2008 の Windows オプション機能は、Pkgmgr という新しいコマンド ツールを使用してインストールされます。 pkgmgr.exe のコマンドライン構文は次のとおりです:

Start /w pkgmgr.exe /iu:update1;update2…

Pkgmgr.exe のコマンド

/iu:{update name};

これは、更新プログラムの名前でインストールする更新プログラムを指定し、インストールする更新プログラムのセミコロンで区切られた名前を取ります。

/uu:{update name};

アンインストールする更新プログラムを指定し、システムからアンインストールする選択可能な更新プログラムのセミコロン区切りの一覧を取得します。 少なくとも 1 つの更新プログラム名を指定する必要があります

/n:{unattend XML}

これは、無人 XML ファイルのファイル名を指定します。

Note

"start /w" プレフィックスを指定せずに pkgmgr を実行すると、pkgmgr cmd はすぐに戻り、オプションの機能のインストールがいつ完了したかはわかりません。

手順 2: コマンド ウィンドウを開く

ローカル管理者アカウントとして実行されているコマンド ウィンドウを開始するには、上記の「前提条件」セクションの手順に従います。

手順 3: Unattend.xml ファイルを作成する

コマンド ウィンドウで、notepad.exe を実行します。

IIS 7.0 の既定の機能のみをインストールするには、次の unattend.xml テキストをメモ帳にコピーします。

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

評価のためにすべての IIS 7.0 機能をインストールする場合は、次のいずれかの unattend.xml ファイルを使用します。

Windows Vista Professional、Windows Vista Ultimate、または Windows Server 2008 エディションの場合は、次のテキストをコピーしてメモ帳に貼り付けます。

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

Windows Vista Home Premium に IIS 7.0 をインストールする場合は、次のテキストをコピーしてメモ帳に貼り付けます:

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

手順 4: Windows ビルド番号を取得する

その後、インストールした Windows のバージョン番号を確認する必要があります。 正確なバージョンを見つけるには、次の操作を行います:

  1. [スタート] メニュー [実行] をクリックし、エクスプローラーに移動します。

    • エクスプローラーで Windows ダイレクトに移動し、regedit.exe を探します
    • regedit.exe ファイルを右クリックし、[プロパティ] を選択します
    • [プロパティ] ダイアログ ボックスで、[詳細] タブを選択し、製品バージョンをメモします。
      [regedit プロパティ] ダイアログ ボックスの [詳細] タブのスクリーンショット。[製品バージョン] フィールドが強調表示されています。
  2. メモ帳で、インストールしたビルドと一致するように XML 属性バージョンにこの値を入力します。

    • この場合、バージョンは "6.0.5308.6" です

    • 64 ビット CPU にインストールしている場合は、processorArchitecture XML 属性を編集する必要があります:

      processorArchitecture="amd64"

Note

指定できる値は: x86、amd64、ia64 です。

手順 5: Unattend.xml ファイルを保存する

"unattend.xml" という名前のメモ帳ファイルを保存する

手順 6: Unattend.xml ファイルを使用して Pkgmgr を実行する

コマンド ウィンドウで、次のコマンド ラインを入力します:

start /w pkgmgr /n:unattend.xml

注: unattend.xml をドライブ フォルダーに保存した場合、コマンド ウィンドウの現在のドライブとフォルダーの他のフォルダーに保存した場合は、pkgmgr /n: パラメーターに unattend.xml ファイルの完全パスを指定する必要があります。

手順 7: セットアップが完了するまで待つ

pkgmgr.exe を使用した IIS 7.0 のセットアップには 1 ~ 5 分かかります。 コマンド プロンプトが返されると、IIS 7.0 のセットアップが完了します。

手順 8: エラー コードを確認する

コマンド プロンプトで、次のコマンドを入力します。

echo %errorlevel%

0 の結果は成功を示します。

まとめ

この記事では、pckmgr.exe を使用してオペレーティング システムと IIS 7.0 をインストールする方法について説明しました。