I’m a profound fan of the DISM (Deployment Image Servicing and Management) command. But I found myself surprised by the behavior of the /resetbase parameter today. For the record, the complete command syntax is DISM /online /cleanup-image /startcomponentcleanup /resetbase. Silly me: I understood that /resetbase would not allow changes to the base established. But I thought the /startcomponentcleanup would run first, and then the base would be reset. Wrong! Today, I tried it on my Surface Pro 3, and DISM /resetbase bites back: the two reclaimable packages I thought would be cleaned up are now frozen into my runtime image. Sigh. Here’s some illustrative PowerShell output, made after I’d already used the /resetbase option:
Notice that even though I ran a /startcomponentcleanup command between a pair of /analyzecomponentstore commands, the 2 reclaimable packages cheerfully persist. Sigh.
[Click image for full-sized view.]
Normally, running the dism /online /cleanup-image /startcomponentcleanup command would result in the second /analyzecomponentstore output reciting zero reclaimable packages, and no recommendation for component store cleanup. But I have no one but myself to blame for this, because I ran the /resetbase myself, not knowing it would freeze first and then fail to clean up at all. That’s why I like playing with test machines: not much real harm results even when things don’t work. Or when they don’t work the way I expect them to…
If DISM /Resetbase Bites Back, What to Do?
Not much, actually. I can either restore my most recent backup and do things right, or I can wait for 2004 and start afresh after that feature upgrade. Doing things right means: run dism /online /cleanup-image /startcomponentcleanup on the restored OS, then run the /resetbase version of that command to freeze the cleaned-up component store. I’m not sure it’s worth the effort, what with 2004 due out in the next month or two. OTOH, the Surface Pro 3 is a test machine and I won’t lose anything except time if I restore the latest Macrium backup, apply pending updates, and try again (the right way).
But now I know something important: if you want to use the /resetbase option in DISM, you should run the DISM /online /cleanup-image /startcomponentcleanup command first. That will clean up anything reclaimable. Then, when the number of reclaimable packages is zero, use the /resetbase option. Now, I know. Hopefully, you too can learn from my mistake. And so it goes, here in Windows-World!