Enable-WindowsOptionalFeature

Enable-WindowsOptionalFeature

Enables a feature in a Windows image.

Syntax

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

Detaillierte Beschreibung

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

Verwenden Sie den Online-Parameter, um das Betriebssystem auf Ihrem lokalen Computer anzugeben, oder verwenden Sie den Path-Parameter zum Angeben des Speicherort eines bereitgestellten Windows-Abbilds.

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.

Parameter

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

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

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.

Aliase

none

Erforderlich?

true

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-LogLevel<LogLevel>

Gibt die maximale Ausgabeebene an, die in den Protokollen angezeigt wird. Die Standardprotokollebene lautet 3. Die zulässigen Werte lauten wie folgt:1 = nur Fehler2 = Fehler und Warnungen3 = Fehler, Warnungen und Informationen4 = alle zuvor genannten Informationen sowie Debugausgabe

Aliase

LL

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-LogPath<String>

Gibt den vollständigen Pfad und den Namen der Protokolldatei an. Wenn nicht festgelegt, lautet der Standardwert %WINDIR%\Logs\Dism\dism.log.. In Windows PE ist das Standardverzeichnis der RAMDISK-Speicherbereich, der 32 MB klein sein kann. Die Protokolldatei wird automatisch archiviert. Die archivierte Protokolldatei wird mit der Dateierweiterung BAK an den Dateinamen angehängt und eine neue Protokolldatei wird generiert. Bei jeder Archivierung der Protokolldatei wird die BAK Datei überschrieben. Wenn Sie eine Netzwerkfreigabe verwenden, die nicht Mitglied einer Domäne ist, verwenden Sie den Befehl "net use" zusammen mit Domänenanmeldeinformationen, um Zugriffsberechtigungen festzulegen, bevor Sie den Protokollpfad für das DISM-Protokoll festlegen.

Aliase

LP

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-NoRestart

Unterdrückt den Neustart. Wenn ein Neustart erforderlich ist, hat dieser Befehl keine Auswirkungen. Diese Option verhindert, dass die Anwendung zu einem Neustart angefordert oder verhindert, dass der Neustart automatisch ausgeführt wird.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-Online

Gibt die auf dem Betriebssystem vorgenommene Aktion an, die derzeit auf dem lokalen Computer ausgeführt wird.

Aliase

none

Erforderlich?

true

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-PackageName<String>

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-Path<String>

Gibt den vollständigen Pfad zum Stammverzeichnis des Offline-Windows-Abbilds, das Sie warten. Wenn das Verzeichnis mit dem Namen Windows kein Unterverzeichnis des Stammverzeichnisses ist, muss WindowsDirectory angegeben werden.

Aliase

none

Erforderlich?

true

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-ScratchDirectory<String>

Gibt ein temporäres Verzeichnis an, das beim Extrahieren von Dateien während der Wartung verwendet wird. Das Verzeichnis muss lokal vorhanden sein. Wenn nicht angegeben, wird das\Windows\%Temp%-Verzeichnis mit einem Unterverzeichnisnamen eines zufällig generierten Hexadezimalwerts bei jeder Ausführung von DISM verwendet. Elemente im Scratchverzeichnis werden nach jedem Vorgang gelöscht. Sie sollten keinen Netzwerkfreigabe-Speicherort als Scratchverzeichnis verwenden, um ein Paket (CAB- oder MSU-Datei) für die Installation zu erweitern. Das Verzeichnis für das Extrahieren von Dateien für die temporäre Verwendung während der Wartung sollte ein lokales Verzeichnis sein.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

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.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-SystemDrive<String>

Gibt den Pfad zum Speicherort der BootMgr-Dateien an. Dies ist nur dann notwendig, wenn sich die BootMgr-Dateien auf einer anderen Partition als der befinden, auf der Sie den Befehl ausführen. Verwenden Sie -SystemDrive, um ein installiertes Windows-Abbild aus einer Windows PE-Umgebung zu warten.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

-WindowsDirectory<String>

Gibt den Pfad zum Windows-Verzeichnis relativ zum Abbildpfad an. Dies kann nicht der vollständige Pfad zum Windows-Verzeichnis sein. Es sollte ein relativer Pfad sein. Wenn nicht angegeben, ist die Standardeinstellung das Windows-Verzeichnis im Stamm des Offline-Imageverzeichnisses.

Aliase

none

Erforderlich?

false

Position?

named

Standardwert

none

Pipelineeingaben akzeptieren?

True (ByPropertyName)

Platzhalterzeichen akzeptieren?

false

<CommonParameters>

Dieses Cmdlet unterstützt die allgemeinen Parameter: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer und -OutVariable. Weitere Informationen finden Sie unter about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).

Eingaben

Der Eingabetyp ist der Typ der Objekte, die Sie per Piping an das Cmdlet übergeben können.

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

Ausgaben

Der Ausgabetyp ist der Typ der Objekte, die vom Cmdlet ausgegeben werden.

  • Microsoft.Dism.Commands.ImageObject

Beispiele

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

Verwandte Themen

Disable-WindowsOptionalFeature

Get-WindowsOptionalFeature

Add-WindowsPackage