I wondered what switches DISM would have to install a new feature from a specified source. I played around a bit with DISM and realized that the version (6.2.9200.16384) in Server 2012 has more features compared to the version (6.1.7600.16385) in Server 2008. I haven’t obviously explored them all out, but as and when I do I’ll make subsequent posts to document them.
An interesting new feature that stands out for me is the fact that the /enable-feature switch now supports an /all switch that automatically installs all the needed dependency features.
C:\Users\Administrator.CONTOSO>dism /online /enable-feature /featurename:NetFx3Deployment Image Servicing and Management toolVersion: 6.2.9200.16384Image Version: 6.2.9200.16384Enabling feature(s)[==========================100.0%==========================]Error: 50The operation is complete but NetFx3 feature was not enabled.A required parent feature may not be enabled. You can use the /enable-feature /all option to automatically enable each parent feature from the following list. If the parent feature(s) are already enabled, refer to the log file for further diagnostics.NetFx3ServerFeaturesThe DISM log file can be found at C:\Windows\Logs\DISM\dism.log |
Unfortunately the /disable-feature doesn’t have a corresponding switch to remove all the automatically installed dependencies so be sure to keep track of these.
The /disable-feature does have a /remove switch though which can be used to disable a package and remove all its binaries. This is one step ahead of what the /disable-feature in the previous DISM version offers. There you could only disable the feature but the binaries (the installed files) would still be on the system; now you have an option to remove them too.
Features whose binaries are thus removed (or were never installed in the first place) are marked differently when you use /get-features:
C:\Users\Administrator.CONTOSO>dism /online /get-features |moreDeployment Image Servicing and Management toolVersion: 6.2.9200.16384Image Version: 6.2.9200.16384Features listing for package : Microsoft-Windows-ServerCore-Package~31bf3856ad364e35~amd64~~6.2.9200.16384Feature Name : NetFx3ServerFeaturesState : DisabledFeature Name : NetFx3State : Disabled with Payload Removed...Feature Name : AdminUIState : Disabled with Payload Removed... |
Note the “Disabled with Payload Removed” status.
If you are trying to install a feature whose binaries (the payload) are not present /enable-features complains about that. You can use the /Source switch to specify a source for these binaries.
C:\Users\Administrator.CONTOSO>dism /online /enable-feature /featurename:AdminUIDeployment Image Servicing and Management toolVersion: 6.2.9200.16384Image Version: 6.2.9200.16384Enabling feature(s)[===========================61.5%=== ]Error: 0x800f0906The source files could not be downloaded.Use the "source" option to specify the location of the files that are required to restore the feature. For more information on specifying a source location, see http://go.microsoft.com/fwlink/?LinkId=243077.The DISM log file can be found at C:\Windows\Logs\DISM\dism.log |
The /Source switch must point to a path similar to the one required by the -Source switch of the Add-WindowsFeature (see my previous blog post or this TechNet article). It must be the C:Windows folder in a WIM file image or on a running Windows installation anywhere else on the network.
C:\Users\Administrator.CONTOSO>dism /get-wiminfo /wimfile:z:\sources\install.wimDeployment Image Servicing and Management toolVersion: 6.2.9200.16384Details for image : z:\sources\install.wimIndex : 1Name : Windows Server 2012 SERVERSTANDARDCOREDescription : Windows Server 2012 SERVERSTANDARDCORESize : 7,195,580,708 bytesIndex : 2Name : Windows Server 2012 SERVERSTANDARDDescription : Windows Server 2012 SERVERSTANDARDSize : 11,999,848,937 bytesIndex : 3Name : Windows Server 2012 SERVERDATACENTERCOREDescription : Windows Server 2012 SERVERDATACENTERCORESize : 7,176,243,455 bytesIndex : 4Name : Windows Server 2012 SERVERDATACENTERDescription : Windows Server 2012 SERVERDATACENTERSize : 11,995,224,677 bytesThe operation completed successfully.C:\Users\Administrator.CONTOSO>dism /mount-wim /wimfile:z:\sources\install.wim /index:2 /mountdir:c:\offline /readonlyDeployment Image Servicing and Management toolVersion: 6.2.9200.16384Mounting image[==========================100.0%==========================]The operation completed successfully.C:\Users\Administrator.CONTOSO>dism /online /enable-feature /featurename:AdminUI /source:c:\offline\windowsDeployment Image Servicing and Management toolVersion: 6.2.9200.16384Image Version: 6.2.9200.16384Enabling feature(s)[==========================100.0%==========================]The operation completed successfully.Restart Windows to complete this operation.Do you want to restart the computer now? (Y/N) |
And that’s it, the feature is installed!
I think I’ll stick to DISM instead of PowerShell for a while while managing features. PowerShell has a DISM module now and hence a subset of the DISM commands, but it’s easier working with DISM exclusively for these sort of tasks as DISM has more features and eventually you will need to depend on DISM for some of these features (managing WIM images, for instance) and so I feel sticking with it exclusively will help breed more familiarity with DISM.
DISM mounted images are persistent across reboots so be sure to /unmount-wim them. You can get a list of mounted WIM images via the /get-mountedwiminfo switch.
C:\Users\Administrator.CONTOSO>dism /get-mountedwiminfoDeployment Image Servicing and Management toolVersion: 6.2.9200.16384Mounted images:Mount Dir : c:\OfflineImage File : z:\sources\install.wimImage Index : 2Mounted Read/Write : NoStatus : Needs RemountThe operation completed successfully.C:\Users\Administrator.CONTOSO>dism /unmount-wim /mountdir:c:offline /discardDeployment Image Servicing and Management toolVersion: 6.2.9200.16384Image File : z:\sources\install.wimImage Index : 2Unmounting image[==========================100.0%==========================]The operation completed successfully. |
The /discard switch is required while un-mounting to tell DISM it doesn’t need to save any changes (not that we made any changes in this case, but one could potentially make changes and save them using DISM). If you wanted to save changes instead use the /commit switch.

Recent Comments