can’t convert VHDx file to WIM

I had experimented earlier with trying to convert a VHDX file to a WIM file. I didn’t know exactly what I was doing at the time and the process didn’t work correctly (I can’t remember exactly what command I typed). Now I am revisiting the issue. I try to run the following command on the same VHDX file I have on my laptop that I tried to convert a few months ago and get an error.

Mount-WindowsImage -ImagePath "C:usersuserXdesktopMyImage.VHDX" -Path "C:usersuserXdesktopMount" -Index 1 

The error I get says “Mount-WindowsImage : The specified VHD has already been mounted. Choose a VHD that has not been mounted and try again.”

When I run “Get-WindowsImage -Mounted” it shows me:

Path : C:usersuserXdesktopWIM

ImagePath : C:usersuserXdesktopMyImage.VHDX

ImageIndex : 1

MountMode : ReadWrite

MountStatus : Invalid

I’ve tried to dismount the VHD with the command:

Dismount-VHD -Path "C:usersuserXdesktopMyImage.VHDX" 

When I do this I get the error “The path “c:usersuserXdesktopMyImage.vhdx” is not the path to a mounted virtual hard disk file.”

The strange thing is that I CAN mount the VHDX file through “Disk Management” without an issue. I imagine the reason this error is occuring is because at one point I deleted the “WIM” directory file that was created during my first attempt to convert the VHDX file because it wasn’t working correctly. Does anyone know how I can convince Powershell to dismount the VHDX file so I can try and convert it to a WIM file? Any help is much appreciated!

submitted by /u/Cipius
[link] [comments]

Leave a Reply