Currently I capture .wim images using dism.exe /capture-image and reapply them to the C: drive using dism.exe /apply-image. All of this is done from the Command Prompt after booting the machine using advanced startup.

How can I create a script or program that will automatically apply an image file I have saved without me having to type in the dism.exe /apply-image command?

This is for automated testing.

  • If I understand your question correctly, you'll need a batch or PowerShell Script which should run on startup, so you need to put it into "autostart". When all of this should only run when booted using "advanced startup", you have to catch the startup with wmi, and only trigger the dism call when the startup option was "advanced startup". – SimonS Nov 11 '16 at 10:25
  • @SimonS Ok. It would be awesome if you were more specific, but also, if I do this how do I reboot the machine into advanced startup with command prompt automatically? – nhouser9 Nov 11 '16 at 17:57

You seem to replace WIM in an interesting fashion. I found this way if you wanted to try another:

Dism /Online /Cleanup-Image /RestoreHealth /Source:wim:drive letter:\sources\install.wim:1 /limitaccess
  • you have to mount a ISO – EmpressBrat Nov 26 '16 at 6:19

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.