I have a DISM
based imaging solution for use in WinPE as follows:
set WshShell = CreateObject("WScript.Shell")
Wscript.StdOut.WriteLine "[44m[1;37m restoring image boot partition for " & name & " [0m[40m"
Set objExec = WshShell.Exec("DISM.exe /Apply-Image /ImageFile:" & name & "/index:1 /ApplyDir:c:\")
Do
line = objExec.StdOut.ReadLine()
Wscript.StdOut.WriteLine line
Loop While Not objExec.Stdout.atEndOfStream
There are two issues with the way this executes:
- The execution seems to stall and I have to press enter for it to continue.
- The second problem is that the progress bar does not show up. It stays at "applying image".
Normally, if you execute DISM.exe /Apply-Image /ImageFile:" & name & "/index:1 /ApplyDir:c:\
it will look something like this:
"applying Image {1%-------------------------------------}
Interestingly this segment which prepares the disk shows each line of execution:
Set WshShell = CreateObject("WScript.Shell")
Set objExec = WshShell.Exec("diskpart.exe /s clean.sh")
Do
line = objExec.StdOut.ReadLine()
Wscript.StdOut.WriteLine line
Loop While Not objExec.Stdout.atEndOfStream
I think the DISM
output is different because it only has one line that refreshes itself, but I'm not sure how to code around it.