I'm attempting to reboot a computer into a flash drive media containing Windows PE, but every time it only launches Preparing Automatic Repair. Here is my powershell that generates the new bcd entry:
$drive = (get-location).Drive.Name + ":"
$output = bcdedit /copy '{current}' /d "automaticabd"
$variable = "{" + $output.Split('{')[-1]
$variable = $variable.TrimEnd('.')
"Attaching $variable to device partition $drive"
bcdedit /set $variable device partition=$drive
""
"Attaching $variable to osdevice partition $drive"
bcdedit /set $variable osdevice partition=$drive
""
"Setting $variable path to EFI: \EFI\Boot\bootx64.efi"
bcdedit /set $variable path \EFI\Boot\bootx64.efi
""
"Other settings..."
bcdedit /set $variable systemroot \windows
bcdedit /set $variable winpe yes
bcdedit /set $variable recoveryenabled No
bcdedit /bootsequence $variable
All operations are completed successfully, and it appears as though the entry is correct to my knowledge:
But, when I restart the computer I used to get the message "Repairing Automatic Recovery" which would then eventually go into Windows Recovery environment. I have since added bcdedit /set $variable recoveryenabled No
, which makes it so it cannot possibly go into the recovery environment, but I get a different error now:
The application or operating system couldn't be loaded because a required file is missing or contains errors.
File: \EFI\Boot\bootx64.efi Error code: 0xc000007b
But, if I go into boot options and select this file manually, it boots into winpe just fine.
I'm not really sure what's going wrong, any help would be greatly appreciated.
How can I fix my code to allow me to successfully boot into Windows PE on my flash drive?
Assessment and Deployment Kit
which doesn't work for me because my purpose for wanting to boot to the flash drive is because these computers I'm running it on are manufacturer default, and must remain that way, plus it would be even less convenient to have to install this on every computer just to boot to the flash drive in 1 click instead of 3. and the 2nd one I don't really think is related at all, that's used when already booted into the flash drive it seems. – Clintclintock