Ten Forums own tutorial guru @Brink has written an excellent tutorial about how to turn Windows optional features on or off in online OS, the current Windows installation user has signed in.
This tutorial shows how to do the same on an offline image, a Windows 10 install media. Mount the install.wim file for offline servicing, add or remove optional features, and save the changes to install media. That's it.
When this install media is then used to install Windows, all the features user prefers to be turned on are already enabled, and those user has removed will be disabled. This is much easier and faster than enabling or disabling optional features after Windows 10 has been installed.
Please notice, that Windows 10 install media (ISO file or USB flash drive) created with Windows Media Creation Tool (MCT) is ESD based, containing install.esd file instead of install.wim. The ESD file cannot be mounted for offline servicing. You must first convert it to WIM (tutorial), or download a WIM based ISO (tutorial).
Mount Windows image: Mount Windows image for offline servicing Add features: Add optional features Remove features: Remove optional features Save changes: Save changes to Windows install media
1.) Plug in USB flash drive containing Windows install files. Alternatively, mount a Windows 10 ISO image as virtual DVD drive (right click ISO file, select Mount), and copy all its files and folders to a folder on hard disk. In this tutorial, I will use folder D:\ISO_Files as an example.
2.) Open an elevated PowerShell (Run as administrator). Enter the following command to check which Windows editions are on your install media:
Get-WindowsImage -ImagePath D:\ISO_Files\Sources\install.wim | Format-Table ImageIndex, ImageName
(Click screenshots to enlarge.)
Check the image index value for the edition you want to edit (offline service). Notice that the features will be enabled or disabled only for your selected edition; installing any other edition will not be affected.
If you want to mount install.wim from a USB flash drive instead of a folder containing ISO files, change the -ImagePath value to X:\Sources\install.wim, where X: is the drive letter for your USB drive.
If your ISO file or USB install media is dual architecture, containing both 32 and 64 bit Windows install files, change path accordingly. Instead of \Sources\install.wim, use either \x32\Sources\install.wim or \x64\Sources\install.wim.
3.) Create a mount point folder. In this tutorial, I will use folder C:\Mount.
4.) Mount selected Windows edition with following command, where X in -index X is image index number of your selected edition:
Mount-WindowsImage -ImagePath D:\ISO_Files\Sources\install.wim -Index X -Path C:\Mount
Change -ImagePath (path to your install.wim file) and -Path (mount point folder) according to your actual ones.
1.) Open a list of by default disabled optional features in Windows image in so called Grid View table with following command:
Get-WindowsOptionalFeature -Path C:\Mount | Where-Object {$_.State –eq “Disabled”} | Out-GridView -PassThru | Enable-WindowsOptionalFeature
Change the path to your actual mount point folder in -Path C:\Mount according to your actual mount point.
If required, expand the FeatureName column in Grid View table:
2.) Holding down the CTRL key, select the optional features you want to add to Windows image, and click OK. In this example, I have selected features Virtual Machine Platform and Windows Subsystem for Linux:
3.) Selected Windows optional features will be added to offline image.
1.) Open a list of enabled optional features in Windows image in so called Grid View table with following command:
Get-WindowsOptionalFeature -Path C:\Mount | Where-Object {$_.State –eq “Enabled”} | Out-GridView -PassThru | Disable-WindowsOptionalFeature
Change the path to your actual mount point folder in -Path C:\Mount according to your actual mount point.
2.) Holding down the CTRL key, select the optional features you want to remove from Windows image, and click OK. In this example, I have selected features Virtual Machine Platform and Windows Subsystem for Linux to be removed:
3.) Selected Windows optional features will be removed from offline image.
1.) Enter the following command to save changes to your Windows install media:
Dismount-WindowsImage -Path C:\Mount -Save
Change the path to your mount point according to the actual one.
2.) Optional Windows features in selected Windows edition have been added or removed as you selected. When the selected edition of Windows 10 is installed from your install media, all selected features added will be enabled by default.
If you added features to a USB install media, or removed features from it, it's ready now. If you had copied ISO files to a folder, you must now create a new ISO from updated files and folders in that folder. You can use whatever ISO creating method you'd prefer. See steps 5.3 to 5.5 in this tutorial for one method to create new ISO: Create Windows 10 ISO image from Existing Installation
That's it, geeks. You might want to read my article about Out-Gridview PowerShell cmdlet used in this tutorial: Out-Gridview – Most versatile PowerShell cmdlet?
Kari