November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

November 2024
M T W T F S S
 123
45678910
11121314151617
18192021222324
252627282930  

DISM in Windows Server 2012

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:NetFx3
Deployment Image Servicing and Management tool
Version: 6.2.9200.16384
Image Version: 6.2.9200.16384
Enabling feature(s)
[==========================100.0%==========================]
Error: 50
The 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.
NetFx3ServerFeatures
The 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 |more
Deployment Image Servicing and Management tool
Version: 6.2.9200.16384
Image Version: 6.2.9200.16384
Features listing for package : Microsoft-Windows-ServerCore-Package~31bf3856ad364e35~amd64~~6.2.9200.16384
Feature Name : NetFx3ServerFeatures
State : Disabled
Feature Name : NetFx3
State : Disabled with Payload Removed
...
Feature Name : AdminUI
State : 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:AdminUI
Deployment Image Servicing and Management tool
Version: 6.2.9200.16384
Image Version: 6.2.9200.16384
Enabling feature(s)
[===========================61.5%===                       ]
Error: 0x800f0906
The 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.wim
Deployment Image Servicing and Management tool
Version: 6.2.9200.16384
Details for image : z:\sources\install.wim
Index : 1
Name : Windows Server 2012 SERVERSTANDARDCORE
Description : Windows Server 2012 SERVERSTANDARDCORE
Size : 7,195,580,708 bytes
Index : 2
Name : Windows Server 2012 SERVERSTANDARD
Description : Windows Server 2012 SERVERSTANDARD
Size : 11,999,848,937 bytes
Index : 3
Name : Windows Server 2012 SERVERDATACENTERCORE
Description : Windows Server 2012 SERVERDATACENTERCORE
Size : 7,176,243,455 bytes
Index : 4
Name : Windows Server 2012 SERVERDATACENTER
Description : Windows Server 2012 SERVERDATACENTER
Size : 11,995,224,677 bytes
The operation completed successfully.
C:\Users\Administrator.CONTOSO>dism /mount-wim /wimfile:z:\sources\install.wim /index:2 /mountdir:c:\offline /readonly
Deployment Image Servicing and Management tool
Version: 6.2.9200.16384
Mounting image
[==========================100.0%==========================]
The operation completed successfully.
C:\Users\Administrator.CONTOSO>dism /online /enable-feature /featurename:AdminUI /source:c:\offline\windows
Deployment Image Servicing and Management tool
Version: 6.2.9200.16384
Image Version: 6.2.9200.16384
Enabling 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-mountedwiminfo
Deployment Image Servicing and Management tool
Version: 6.2.9200.16384
Mounted images:
Mount Dir : c:\Offline
Image File : z:\sources\install.wim
Image Index : 2
Mounted Read/Write : No
Status : Needs Remount
The operation completed successfully.
C:\Users\Administrator.CONTOSO>dism /unmount-wim /mountdir:c:offline /discard
Deployment Image Servicing and Management tool
Version: 6.2.9200.16384
Image File : z:\sources\install.wim
Image Index : 2
Unmounting 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.

 

Leave a Reply

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>