Share via


Enable or Disable Windows Features Offline

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.

DISM is a command-line tool used to update offline Windows® images. There are two ways to enable or disable features offline with Deployment Image Servicing and Management (DISM.exe). You can either apply an unattend answer file to the offline image, or you can enable or disable features directly from the command prompt.

You must install the latest version of the Windows OEM Preinstallation Kit (Windows OPK), which contains all of the tools required, including Windows System Image Manager (Windows SIM) and DISM.

To enable Windows features offline by using DISM

  1. At an elevated command prompt, navigate to the OPK servicing folder, and type the following command to retrieve the name or index number for the image you want to modify.

    Dism /Get-WIMInfo /WimFile:C:\test\images\install.wim
    

    An index or name value is required for most operations that specify a Windows imaging (WIM) file.

  2. Type the following command to mount the offline Windows image.

    Dism /Mount-WIM /WimFile:C:\test\images\install.wim /Name:"Windows 7 HomeBasic" /MountDir:C:\test\offline>
    
  3. Optional: At the command prompt, type the following command to list all of the features available in the operating system.

    Dism /Image:C:\test\offline /Get-Features
    

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

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

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

    Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Hearts
    
  6. Type the following command to enable a specific feature in the image.

    Dism /Image:C:\test\offline /Enable-Feature /FeatureName:Hearts
    
  7. Type the following command to commit the changes and unmount the image.

    Dism /Unmount-WIM /MountDir:C:\test\offline /Commit
    

To disable Windows features offline by using DISM

  1. At an elevated command prompt, navigate to the OPK servicing folder, and type the following command to retrieve the name or index number for the image you want to modify.

    Dism /Get-WIMInfo /WimFile:C:\test\images\install.wim
    

    An index or name value is required for most operations that specify a WIM file.

  2. Type the following command to mount the offline Windows image.

    Dism /Mount-WIM /WimFile:C:\test\images\install.wim /Name:"Windows 7 HomeBasic" /MountDir:C:\test\offline
    
  3. Optional: At the command prompt, type the following command to list all of the features available in the operating system.

    Dism /Image:C:\test\offline /Get-Features
    
  4. Review the list of features to find the feature that you want to disable.

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

    Dism /Image:C:\test\offline /Get-FeatureInfo /FeatureName:Hearts
    
  6. Type the following command to disable a specific feature in the image.

    Dism /Image:C:\test\offline /Disable-Feature /FeatureName:Hearts
    
  7. Type the following command to commit the changes and unmount the image.

    Dism /Unmount-WIM /MountDir:C:\test\offline /Commit
    

To enable or disable Windows features offline 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 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 choice.

    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 OPK servicing folder, and type the following command to retrieve the name or index number for the image you want to mount.

    Dism /Get-WIMInfo /WimFile:C:\test\images\install.wim
    
  9. Type the following command to mount the offline Windows image.

    Dism /Mount-WIM /WimFile:C:\test\images\install.wim /Name:"Windows 7 HomeBasic" /MountDir:C:\test\offline
    

    An index or name value is required for most operations that specify a WIM file.

  10. At the command prompt, type the following command to apply the unattended answer file to the image.

    DISM /Image:C:\test\offline /Apply-Unattend:C:\test\answerfiles\myunattend.xml
    
  11. At the command prompt, type the following command to commit the changes and unmount the image.

    Dism /Unmount-WIM /MountDir:C:\test\offline /Commit
    

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
Unattended Servicing Command-Line Options
Windows System Image Manager Technical Reference