Monday, November 10, 2014

How to deploy a Windows Image on UEFI-based Computers

In an earlier post I described how to deploy a Windows Image on UEFI-based Computers using PXE boot. This post can be found here: Blogpost. This time I want to deploy a Windows image on a Hyper-V Generation 2 VM using ConfigMgr boot media. Because Generation 2 is using UEFI and Secureboot, deployment is not working by default. Let's have a look at some errors I see when starting deployment from a 64-bit boot image.

-Unable to find a raw disk that could be partitioned as the system disk.
-Failed to prepare the system partition for staging. The system cannot find the drive specified. (Error: 8007000F; Source: Windows)
-Failed to stage WinPE. Code(0x8007000F)


-System partition not set.
-Unable to find the partition that contains the OS boot loaders. Please ensure the hard disks have been properly partitioned.
-Failed to prepare the system partition for staging. Unspecified error (Error: 80004005; Source: Windows)
-Failed to stage WinPE. Code(0x80004005)


Trick is you must disable Secureboot and create UEFI partitions yourself. Just turn Secureboot off in properties and when ConfigMgr boot media is started press F8 and create partitions yourself.
  • Diskpart
  • Select disk 0 (0 being the disk to setup)
  • Clean (wipe the disk)
  • Convert gpt (convert disk to GPT)
  • Create partition efi size=200 (EFI system partition)
  • Assign letter=s (Any allowable letter)
  • Format quick fs=FAT32 (Format the ESP)
  • Create partition msr size=128 (Create the MSR partition)
  • Create partition primary (Create Windows partition)
  • Assign letter=c
  • Format quick fs=NTFS (Format primary partition)
  • Exit
After that start the task sequence and you will be fine. Just make sure the ConfigMgr boot media using is 64-bit and the one used on the deployment task sequence is 64-bit also. This is mandatory to get the job done. Hope it helps!

Comment 8-4-2016: Create a diskpart script and add it into your USB/ISO (not PXE) media, if you don't want to type it manually. Press F8 and start your script with: diskpart /s filename.txt (Source)

More blogposts on this topic:
PXE Boot files in RemoteInstall folder explained (UEFI)

37 comments:

  1. Is there a way to run these commands in the task sequence or is this going to be a manual step?

    ReplyDelete
    Replies
    1. Didn't tried that before. You can however use diskpart in a task sequence as well.

      Delete
  2. Did you ever find a workaround or a fix for this?

    ReplyDelete
  3. Hi Henk,
    I have exactly the same issue on HYPER-V Generation 2 VM. Do you have any solution to solve this issue?

    ReplyDelete
    Replies
    1. Trick is you must disable Secureboot and create UEFI partitions yourself.

      Hope it helps!

      Delete
  4. Thank you for this article.

    ReplyDelete
  5. Why doesn't it work just disabling secureboot, then reboot, and try the media again?

    ReplyDelete
    Replies
    1. Trick is you must disable Secureboot and create UEFI partitions yourself.

      /Henk

      Delete
  6. Create a diskpart script and add it into your usb/iso (not PXE) media, if you don't want to type it manually. Press F8 and start your script with:
    diskpart /s filename.txt
    https://technet.microsoft.com/en-us/library/hh825686.aspx#RecommendedConfiguration

    ReplyDelete
    Replies
    1. Good idea, did use this sometimes in deployment too! Thanks for the comment.

      Delete
  7. Hi, just wanted to share with you my progess on this :) https://social.technet.microsoft.com/Forums/en-US/dd9a11b9-c3ae-4825-8262-e2754f6f7344/how-to-convert-mbr-to-gpt-automatically-before-the-ts-starts?forum=ConfigMgrCBOSD#dd9a11b9-c3ae-4825-8262-e2754f6f7344

    ReplyDelete
  8. I am bit confused as to why this isn't being done by the task sequence; isn't that what the partition step is for?

    I had some Windows7 laptops that had SecureBoot and UEFI disabled. I re-enabled them as I am deploying a Windows 10 image. I got the 0x80004005 and 0x80070070 errors. So I tried doing a clean in diskpart but it still failed on next try. So it seems deployments aren't actually partitioning the system, just formatting to apply wim?

    ReplyDelete
    Replies
    1. Normally this is done during the task sequence indeed. But when that's not possible, you must create them manually or by scripting.

      Delete
  9. I've got the same issue with Dell E5570. I've changed the the boot setting to "Legacy boot" in the BIOS. Fixed my issue.

    ReplyDelete
  10. I've ran the script and partitions are created just fine. My task sequence is also start running. The only problem I am getting is that my TS is set to download the prestage contents to the hard drive. So once that is done it says to remove USB drive and reboot. The problem I get is that the PC is not booting from the task sequence that was copied to the hard drive.
    Tried changing BIOS settings but none seems to help.
    Any suggestions please????

    ReplyDelete
    Replies
    1. Carlos,

      I'm having the same issue. Were you able to solve the problem?

      Thanks

      Delete
    2. Carlos Quesada...I am having the same issue. Did you ever find a fix? - L. May

      Delete
    3. I am facing the same issues. Could someone help me out as to how to setup scripts within TS for this. I have set this step as 'Continue on Error' and my TS goes till the last step successfully. So, this is the only issue I am facing.

      Delete
  11. creating the partitions beforehand worked for me. thanks for posting!!!

    ReplyDelete
  12. Nice, worked for me!!

    ReplyDelete
  13. worked for great

    ReplyDelete
  14. Thank you, this issue has been driving me crazy. Worked 1st try on two different model Dell laptops.

    Thank you again!

    ReplyDelete
  15. One of the simplest steps and explanations I have come across in any blog. Thanks a lot

    ReplyDelete
  16. Thank you, this got my Lenovo X1 tablet going!

    ReplyDelete
  17. For me when I disable the secure boot everything works fine without any need to partition manually, but still searching for a way that will not make me lose the secure boot features.

    ReplyDelete
  18. Good solution for the boot disk failure issue. Most of the times it may be hard disk issue or sometimes even loose connection can cause boot disk failure problem. Keep writing more on other topics also.

    ReplyDelete
  19. Thank You so much for this tutorial. I had huge problems with installing Windows on my computer because of UEFI.

    ReplyDelete
  20. Had to say thank you, this helped me a lot!

    ReplyDelete