Home Dashboard Directory Help
Search

DCR: Dismount-WindowsImage needs a -Force parameter by Trevor Sullivan


Status: 

Active


16
0
Sign in
to vote
Type: Suggestion
ID: 809144
Opened: 11/20/2013 12:01:01 PM
Access Restriction: Public
0
Workaround(s)
view

Description

We've all been there before.

It was a dark, stormy night, and from within your home shines a bright light of several computer monitors. Empty beer bottles litter the place, but nonetheless you keep typing away at your PowerShell console.

You try to dismount a WIM file using image.exe, dism.exe, or now in the modern day, the "dism" module for Windows PowerShell, and you get the dreaded error similar to the following: "Dismount-WindowsImage : The directory could not be completely unmounted. This is usually due to applications that still have files opened within the mount directory. Close these files and unmount again to complete the unmount process."

In frustration, you throw the half-empty pizza box on your desk, sending pizza, grease, crumbs, and garlic sauce flying across the room. You don't care though. You simply want to DISMOUNT. THE. WIM. FILE. With what seems like several hundred windows open, you frantically start closing them, realizing that you just killed your browser, which was playing Pandora. Great, no music now. You ask yourself: "why should I have to close every single application just to dismount this darn WIM file??"

Just as you're about to try dismounting the image again, your friend texts you and tells you about Sysinternals handle.exe and the built-in Resource Monitor tool, both which allow you to search for file handles and close them (or at least close the owning process). Oh well, too late now.

You go back to your PowerShell console, hit the {Up Arrow}, and then bang on the {ENTER} key. Sure enough, the WIM file is dismounted successfully. You stand up in your underwear, pump your fists in the air, as you yell out: "ALL HAIL the victor!!!" Grudingly picking up the pizza strewn over the floor, you head down to the kitchen, toss it in the trash, and get another beer.

Your next adventure is about to unfold ...

In all seriousness: as far as I know, ImageX, dism, and the Dism PowerShell module have never done the following:

1) Displayed a list of processes that have open handles to the mounted directory
2) Allowed you to specify a /Force or -Force parameter that allows you to force close the handles

In the next version of the Dism module, it would be fabulous if we could get a -Force parameter on the Dismount-WindowsImage cmdlet, so that we can terminate file handles when we "know" that it should not be detrimental (eg. Windows Explorer is still open).
Details
Sign in to post a comment.
Sign in to post a workaround.
File Name Submitted By Submitted On File Size  
2013-11-20 Dismount-WindowsImage.PNG 11/20/2013 74 KB