Dela via


Enable or Disable Windows Features Online

Applies To: Windows 7, Windows Server 2008 R2

Note

This content applies to Windows 7. For Windows 8 content, see Windows Deployment with the Windows ADK.

There are two ways to enable or disable Windows® features on a running operating system using Deployment Image Servicing and Management (DISM.exe). You can use DISM commands directly from the command prompt to list the features that are available in the operating system as well as information about a specific feature. You can then enable or disable specific features. Alternately, you can create an unattended installation answer file in Windows System Image Manager (Windows SIM) and use DISM to apply the answer file.

Note

Feature names are case sensitive.

To enable Windows features by using DISM on a running operating system

  1. At an elevated command prompt, navigate to the Servicing folder.

  2. At the command prompt, type the following command to list all of the features available in the operating system.

    Dism /online /Get-Features
    

    You can use >featurelist.txt to output the list to a text file named FeatureList.

  3. Review the list of features to find the feature that you want to enable.

  4. Optional: At the command prompt, type the following command to list information about the specific feature you are interested in.

    Dism /online /Get-FeatureInfo /FeatureName:Hearts
    
  5. Type the following command to enable a specific feature in the image.

    Dism /online /Enable-Feature /FeatureName:Hearts
    

To disable Windows features by using DISM on a running operating system

  1. At an elevated command prompt, navigate to the Servicing folder.

  2. At the command prompt, type the following command to list all of the features available in the operating system.

    Dism /online /Get-Features
    

    You can use >featurelist.txt to output the list to a text file named FeatureList.

  3. Review the list of features to find the feature that you want to enable.

  4. Optional: At the command prompt, type the following command to list information about the specific feature you are interested in.

    Dism /online /Get-FeatureInfo /FeatureName:Hearts
    
  5. Type the following command to disable a specific feature in the image.

    Dism /online /Disable-Feature /FeatureName:Hearts
    

To enable or disable Windows features on a running operating system by using DISM and an answer file

  1. In Windows SIM, open an existing catalog by right-clicking Select a Windows Image or Catalog file and specifying the catalog file type (.clg) in the drop-down list, or create a new catalog by clicking Create Catalog on the Tools menu.

  2. Expand the catalog in the Windows Image pane, and then expand Packages.

  3. Expand Foundation, and then right-click Microsoft-Windows-Foundation-Package.

  4. Click Add to Answer File.

  5. Click Enabled or Disabled next to the features that you intend to enable or disable. Click the arrow to select the opposite.

    You might need to expand an item to see all of its children. You must enable the parent if any of its children are enabled.

  6. Click Tools on the main menu, and click Validate Answer File.

  7. Correct any errors that appear in the Messages pane, and save the answer file.

  8. At an elevated command prompt, navigate to the servicing folder and run DISM to apply the unattended answer file. For example:

    Dism /online /Apply-Unattend:C:\test\answerfiles\myunattend.xml
    

For more information about Windows SIM, see Windows Setup Technical Reference.

See Also

Concepts

Deployment Image Servicing and Management Technical Reference
Operating System Package Servicing Command-Line Options
Service an Online Image