PowerShell Logo Small


This is the built-in help made by Microsoft for the command 'Disable-WindowsOptionalFeature', in PowerShell version 5 - as retrieved from Windows version 'Microsoft Windows Server 2012 R2 Standard' PowerShell help files on 2016-06-23.

For PowerShell version 3 and up, where you have Update-Help, this command was run just before creating the web pages from the help files.


Disables a feature in a Windows image.


Disable-WindowsOptionalFeature [-LogLevel <LogLevel>] [-LogPath <String>] [-NoRestart] [-PackageName <String>] [-Remove] [-ScratchDirectory <String>] [-SystemDrive <String>]
[-WindowsDirectory <String>] -FeatureName <String[]> -Online [<CommonParameters>]
Disable-WindowsOptionalFeature [-LogLevel <LogLevel>] [-LogPath <String>] [-NoRestart] [-PackageName <String>] [-Remove] [-ScratchDirectory <String>] [-SystemDrive <String>]
[-WindowsDirectory <String>] -FeatureName <String[]> -Path <String> [<CommonParameters>]

Search powershellhelp.space


The Disable-WindowsOptionalFeature cmdlet disables or removes an optional feature in a Windows image.

Use the Online parameter to specify the running operating system on your local computer, or use the Path parameter to specify the location of a mounted Windows image.

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 remove. You can specify more than one feature in the same package. Separate feature names with a comma.

The Remove parameter removes the files for an optional feature without removing the feature's manifest from the image. You can use Remove to reduce the disk space that is
used by a Windows image. After the image has been installed, you can restore the feature at any time from a remote source such as WindowsUpdate or a network share. For more
information about Features on Demand, see Configure a Windows Repair Source.



Online Version: http://go.microsoft.com/fwlink/p/?linkid=289351




Example 1

PS C:\>Disable-WindowsOptionalFeature –Online –FeatureName Hearts

This command disables an optional feature, Hearts, from the running Windows operating system.

Example 2

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

This command disables the optional feature, Calc, in the specified package in the Windows image that is mounted to c:\offline. It also removes all of the files except the
manifest file, which reduces the size of the Windows image. The feature can be restored with the Enable-WindowsOptionalFeature cmdlet or by using Features on Demand at any
time after the image is deployed.