Enable-WindowsOptionalFeature

Enable-WindowsOptionalFeature

Enables a feature in a Windows image.

構文

Parameter Set: Offline
Enable-WindowsOptionalFeature -FeatureName <String[]> -Path <String> [-All] [-LimitAccess] [-LogLevel <LogLevel> {Errors | Warnings | WarningsInfo} ] [-LogPath <String> ] [-NoRestart] [-PackageName <String> ] [-ScratchDirectory <String> ] [-Source <String[]> ] [-SystemDrive <String> ] [-WindowsDirectory <String> ] [ <CommonParameters>]

Parameter Set: Online
Enable-WindowsOptionalFeature -FeatureName <String[]> -Online [-All] [-LimitAccess] [-LogLevel <LogLevel> {Errors | Warnings | WarningsInfo} ] [-LogPath <String> ] [-NoRestart] [-PackageName <String> ] [-ScratchDirectory <String> ] [-Source <String[]> ] [-SystemDrive <String> ] [-WindowsDirectory <String> ] [ <CommonParameters>]

詳細説明

The Enable-WindowsOptionalFeature cmdlet enables or restores an optional feature in a Windows image.

Online パラメーターを使用して、ローカル コンピューター上で実行されているオペレーティング システムを指定するか、または、Path パラメーターを使用して、マウントされている Windows イメージの場所を指定します。

The PackageName parameter specifies the package that the feature is a component of. This parameter is optional when the package is the Windows Foundation package.

The FeatureName parameter specifies the feature to add. You can specify more than one feature in the same package. Separate feature names with a comma.

The Source parameter specifies the location of files that are needed to restore a removed feature.

The LimitAccess parameter prevents access to Windows Update as a Source for restoring features to online images. The All parameter enables all parent features of the specified feature before enabling the specified feature. The parent feature will be enabled with default values.

パラメーター

-All

Enables all parent features of the specified feature. If a parent feature is required for the specified feature to be enabled in the image, All will enable the parent and all of its default dependencies.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-FeatureName<String[]>

Specifies the name of the feature to be enabled. Feature names are case sensitive if you are servicing a Windows image running a version of Windows earlier than Windows® 8. You can use Get-WindowsOptionalFeature to find the name of the feature in the image.

Aliases

none

必須/オプション

true

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-LimitAccess

Prevents DISM from contacting Windows Update when searching for the source files to restore a feature on an online image.

LimitAccess can only be used when servicing images with Windows 8, Windows Server® 2012, Windows® Preinstallation Environment (Windows PE) 4.0 or a later version.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-LogLevel<LogLevel>

ログに表示される最大出力レベルを指定します。既定のログ レベルは 3 です。指定できる値は次のとおりです。1 = エラーのみ2 = エラーと警告3 = エラー、警告、情報4 = これらすべての情報に加え、デバッグ出力

Aliases

LL

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-LogPath<String>

ログ出力先の完全パスとファイル名を指定します。設定しなかった場合、既定値の %WINDIR%\Logs\Dism\dism.log が使用されます。Windows PE の既定のディレクトリは RAMDISK スクラッチ領域 (32 MB) です。ログ ファイルは自動的にアーカイブされます。アーカイブされたログ ファイルはファイル名に .bak が追加されて保存され、新たなログ ファイルが生成されます。ログ ファイルがアーカイブされるたびに、.bak ファイルが上書きされます。ドメインに参加していないネットワーク共有を使う場合、DISM ログのパスを設定する前に、ドメイン資格情報を指定して net use コマンドを使ってアクセス許可を設定します。

Aliases

LP

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-NoRestart

再起動を抑制します。再起動が不要である場合、このコマンドは何も行いません。これは、アプリケーションで再起動を要求するプロンプトが表示されたり、自動で再起動されたりしないようにするためのオプションです。

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-Online

現在ローカル コンピューターで実行中のオペレーティング システムを操作の対象に指定します。

Aliases

none

必須/オプション

true

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-PackageName<String>

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-Path<String>

操作するオフライン Windows イメージのルート ディレクトリの完全パスを指定します。Windows という名前のディレクトリがルート ディレクトリのサブディレクトリではない場合、-WindowsDirectory を指定する必要があります。

Aliases

none

必須/オプション

true

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-ScratchDirectory<String>

サービスの実行中、ファイルを展開するときに使用する一時ディレクトリを指定します。このディレクトリは、ローカルに存在する必要があります。指定しなかった場合、\Windows\%Temp% ディレクトリが使用され、DISM を実行するたびに、16 進値のサブディレクトリ名がランダムに生成されます。スクラッチ ディレクトリ内の項目は、各操作後に削除されます。インストール用のパッケージ (.cab または .msu ファイル) を展開するためのスクラッチ ディレクトリとしてネットワーク共有場所を使用することは避けてください。サービス中に一時的に使用するファイルの展開先として使用するディレクトリは、ローカル ディレクトリにする必要があります。

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-Source<String[]>

Specifies the location of the files that are required to restore a feature that has been removed from the image. You can specify the Windows directory of a mounted image or a running Windows installation that is shared on the network.

If you specify multiple Source arguments, the files are gathered from the first location where they are found and the rest of the locations are ignored. Separate feature names with a comma.

If you do not specify a Source for a feature that has been removed, the default location set by Group Policy is used. Windows Update is also used for online images.

Source can only be used when servicing an image with Windows 8 or Windows Server 2012 or a later version.

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-SystemDrive<String>

BootMgr ファイルの場所へのパスを指定します。これは、BootMgr ファイルの置かれているパーティションが、コマンドの実行されているパーティションと異なる場合にのみ必要となります。インストールされている Windows イメージを Windows PE 環境から操作するには、-SystemDrive を使用します。

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

-WindowsDirectory<String>

イメージのパスを基準にして、Windows ディレクトリへのパスを指定します。Windows ディレクトリへの完全パスは使用できません。相対パスで指定する必要があります。指定しない場合、オフライン イメージ ディレクトリのルートにある Windows ディレクトリが既定で使用されます。

Aliases

none

必須/オプション

false

位置

named

既定値

none

パイプライン入力の受け入れ

True (ByPropertyName)

ワイルドカード文字の受け入れ

false

<CommonParameters>

このコマンドレットは共通のパラメーターをサポートしています(-Verbose、-Debug、-ErrorAction、-ErrorVariable、-OutBuffer、および -OutVariable)。詳細については、TechNet の「 「about_CommonParameters」 (https://go.microsoft.com/fwlink/p/?LinkID=113216) を参照してください。

入力

入力型は、コマンドレットにパイプできるオブジェクトの型です。

  • System.String[]
  • Microsoft.Dism.Commands.ImageObject
  • Microsoft.Dism.Commands.BasicFeatureObject
  • Microsoft.Dism.Commands.AdvancedFeatureObject

出力

出力型は、コマンドレットが出力するオブジェクトの型です。

  • Microsoft.Dism.Commands.ImageObject

使用例

Example 1: Enable an optional feature in the running operating system

This command enables the optional feature, Hearts, the parent feature for Hearts, and the dependencies for the parent feature in the running Windows operating system.

PS C:\> Enable-WindowsOptionalFeature –Online –FeatureName "Hearts" -All

Example 2: Enable an optional feature in a mounted operating system image

This command enables the optional feature, Calc, in the specified package in the Windows image that is mounted to c:\offline.

PS C:\> Enable-WindowsOptionalFeature –Path "c:\offline" –FeatureName "Calc" –PackageName "Microsoft.Windows.Calc.Demo~6595b6144ccf1df~x86~en~1.0.0.0"

Example 3: Restore an optional feature

This command restores the optional feature, MyFeature, to the Windows image that is mounted to c:\offline using source files from another Windows image that is mounted to c:\test\mount. If the files are not found in the source image, this command specifies not to check Windows Update for the source files.

PS C:\> Enable-WindowsOptionalFeature –Online –FeatureName "MyFeature" –Source "c:\test\mount" -LimitAccess

関連項目

Disable-WindowsOptionalFeature

Get-WindowsOptionalFeature

Add-WindowsPackage