[Solved] Mount-WindowsImage Error 0xc0040009

I wanted to mount an image but I got the following error:

Mount-WindowsImage : DismInitialize failed. Error code = 0xc0040009
At line:1 char:1
+ Mount-WindowsImage -Path D:\MountedImage -ImagePath D:\sources\2019\b ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Mount-WindowsImage], COMException
+ FullyQualifiedErrorId : Microsoft.Dism.Commands.MountWindowsImageCommand

This was due to the fact that the file was read-only (which is usually the case when you copy it from a CD/DVD to a hard drive).

An easy way to set file attributes is to use the Set-ItemProperty cmdlet.
Normaly, there is no need to have any attribute on this file. So you can set it to Normal.

Set-ItemProperty -Path D:\Sources\2019\boot.wim -Name Attributes -Value Normal

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s