We are deploying an image that is actually dual-boot. We have a small linux partition at the beginning of the disk that has DBAN installed on it. The idea is that whenever we want, we can simply change the default boot option via bcdedit, reboot the system, and it will wipe itself for us. However, for normal usage we want the default to be Windows 7. This should be done with a timeout of 0 so that the boot menu is never displayed. The image was tested and captured this way. When provisioning a system, I checked while in WinPE, and it was still set this way. However, after the system reboots, it defaults to a timeout of 30 seconds. How would I go about setting this back. I figure that I just need to execute a 'bcdedit /timeout 0', But I can't make it actually work. When I try it as an execute action in provisioning, it fails. When I try a software distribution task in provisioning that is a batch file with that in it, it fails. I can't seem to figure out any way of running bcdedit on the already installed system.
I'm not sure why BCDEdit wouldn't want to run. Are you running that command in the WinPE phase or the Windows phase? If in WinPE you would need to add the /store switch and point to your bcd file. If in Windows you shouldn't need to worry about that. In either case I would expect it to complete without error. Can you try running a batch file with the command followed by:
echo %errorlevel% > C:\Output.txt
(Replace C:\Output.txt with where you would actually like that error code to go)
Once that's done, let me know what error code you get in that file. This will probably make the task appear to succeed, because the echo command will likely work, but obviously the real problem will still be there, so we'd like to find out what that is.
Sorry, I should have updated this. I actually figured out something that works. It turns out that SysPrep wasn't the problem (If I manually ran bcdedit in WinPE, it still showed a timeout of 0). The problem was actually in the mini-Setup that runs after CTOS. It detected the other OS (DBAN) and automatically changed the timeout. The easiest way I came up with was to actually just modify the source image to include a command in HKLM\Software\Microsoft\CurrentVersion\RunOnce to reset it. This ran after mini-Setup completed, and seems to work just fine.
It looks like the reason that it wasn't working via batch file software distribution task was probably due to the 64-Bit File redirection. When I created a 64-Bit Exe with AutoIT, it works just like it should.
Thanks for letting me know the solution. I'm glad you got it figured out. I wasn't aware that it's actually the mini-setup that tweaks that. I was under the impression it was during the sysprep process.
That's great information. Thanks again for sharing!