/build/static/layout/Breadcrumb_cap_w.png

BIOS/UEFI Combined Tasks

We consider this the new way to deploy an image.  Capture a BIOS configured single partition image.  Then for deployment, is using 6.1.251 or higher, apply the task group named "[DISK] BIOS/UEFI Tasks". If using version 6.0.425 or lower create the following 2 bat script tasks.

Preinstall bat task

@echo off
wpeutil UpdateBootInfo
for /f "tokens=2* delims= " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET FIRMWARE=%%B
echo Firmware Type: %FIRMWARE%
echo Explanation of Firmware Type: (0x1 is BIOS, 0x2 is UEFI)
if %FIRMWARE%==0x1 goto BIOS
if %FIRMWARE%==0x2 goto UEFI
goto END

:UEFI
(
ECHO select disk 0
ECHO clean
ECHO convert gpt noerr
ECHO create partition efi size=200
ECHO assign letter=s
ECHO format quick fs=FAT32
ECHO Create partition msr size=128
ECHO create partition primary
ECHO assign letter=c
ECHO format quick fs=NTFS
ECHO exit
)>X:\Windows\System32\UEFI.txt
diskpart /s X:\Windows\System32\UEFI.txt
goto END

:BIOS
(
ECHO select disk 0
ECHO clean
ECHO create partition primary
ECHO select partition 1
ECHO assign letter=c
ECHO active
ECHO format quick fs=NTFS
ECHO exit
)>X:\Windows\System32\BIOS.txt
diskpart /s X:\Windows\System32\BIOS.txt
goto END

:END

Make sure there is a tab and a space between 'delims=' and " %%A"

Then create a midlevel bat task

@echo off
for %%I in (Z W V U S R Q P O N M L K J I H G F E D C) do (
if exist %%I:\BOOT if not exist %%I:\SOURCES\BOOT.WIM set BOOTSYS_DRIVE=%%I:
if exist %%I:\WINDOWS if not exist %%I:\SOURCES\BOOT.WIM set WINDOWS_DRIVE=%%I:
)
wpeutil UpdateBootInfo
for /f "tokens=2* delims= " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET FIRMWARE=%%B

@echo on
echo Boot Drive: %BOOTSYS_DRIVE%
echo Windows Drive: %WINDOWS_DRIVE%
echo Firmware Type: %FIRMWARE% (0x1 is BIOS, 0x2 is UEFI)
echo Explanation of Firmware Type: (0x1 is BIOS, 0x2 is UEFI)

if %FIRMWARE%==0x1 goto BIOS
if %FIRMWARE%==0x2 goto UEFI
goto END

:UEFI
bcdboot %WINDOWS_DRIVE%\windows /s s: /f UEFI
bcdedit /store S:\efi\microsoft\boot\bcd /set {bootmgr} device partition=s:
bcdedit /store S:\efi\microsoft\boot\bcd /set {memdiag} device partition=s:
bcdedit /store S:\efi\microsoft\boot\bcd /set {default} device partition=%WINDOWS_DRIVE%
bcdedit /store S:\efi\microsoft\boot\bcd /set {default} osdevice partition=%WINDOWS_DRIVE%
Bcdedit /store S:\efi\microsoft\boot\bcd /set {FWbootmgr} displayorder {Bootmgr} /addfirst
bootsect /nt60 s:
goto END

:BIOS
if not defined BOOTSYS_DRIVE (
bcdboot %WINDOWS_DRIVE%\windows /s %WINDOWS_DRIVE%
)
goto END

:END

Make sure there is a tab and a space between 'delims=' and " %%A"

Attach these 2 tasks to your BIOS captured single partition image and go at it!!!

These 2 tasks will automatically determine if you are running BIOS or UEFI and applly the appropriate partitioning.
***Warning, issues can arise if using these on images that are not single partition or were captured from a UEFI system.

These tasks will be included as a task group when upgrading to SDA version 6.1, later this year.





Comments

  • This works great! Thanks for posting Corey. - jamie_kace 3 years ago
  • After applying these tasks to a recently updated, captured from single partition image and deploying to a Latitude 5580, 5590, and Optiplex 7060, all of which are UEFI but set to boot legacy, the image successfully landed on the 5580, but not the other 2. The SSD does not appear as a boot option. Tried resetting back to UEFI and no boot device found. While I dig into the Knowledgebase, has anyone seen this behavior? - anonymous_116816 2 years ago
    • If you are booting from a Legacy Source, I believe you won't be able to Install UEFI boot sectors.

      See this image:
      https://imgur.com/a/DxbU2Ci

      If you are going to do UEFI, you will need to boot from a UEFI source, and make sure the Boot Mode is set to UEFI as well.

      The SSD is unable to locate a UEFI boot partition, because they are not being created.(because the imaging is being made in Legacy mode) - Channeler 2 years ago
  • Thanks Channeler, I did use the guide in the link you shared to create my pre and mid-level tasks. The issue is my 2 newer systems (Opti 7060 and Latitude 5590) aren't offering the Internal HDD as a boot option in legacy. If I change bios settings to go into UEFI Secure boot either off or on, There is no boot device found. I had no such trouble with the year older Latitude 5580, that worked as expected. - anonymous_116816 2 years ago
    • **they aren't offering the Internal HDD as a boot option in legacy**
      Because those systems are pure UEFI, you will need to boot in UEFI, create UEFI partitions and deploy your Image.

      Update your BIOS to the latest version and then check the device manual, they (those devices) should offer your a UEFI onboard NIC boot option.

      Anyway, the KACE Appliance has zero power over the BIOS and it's boot options, this is not a KACE issue.

      But you are not alone out there, please check this URL, about a Dell Latitude 5590:

      https://social.technet.microsoft.com/Forums/en-US/80dd7a2d-44ac-4cc8-b8a4-9bdee6f10c2b/uefi-no-bootable-devices-found?forum=mdt

      This guy is using a Microsoft Imaging solution, but it has the same issue, read the post from the user named 'SteveInOregon2017', from April 13th

      Another example , See:
      https://www.reddit.com/r/sysadmin/comments/8reu9l/psa_dells_new_models_will_lock_you_out_of_using/ - Channeler 2 years ago
  • Why should it matter if the WIM of the C:\Windows drive was captured on a BIOS or UEFI system? - AAnschutz 2 years ago
    • Technically it should not matter. But I think we suggested using a legacy system since it can be setup to have only a single partition and when you capture the image it is simpler to capture the single partition on a BIOS image as opposed to remembering to deselect the S drive before capturing a UEFI image. - jamie_kace 2 years ago
  • Was this based on my original solution as posted here? - https://www.itninja.com/blog/view/uefi-bios-detection-in-scripted-installation

    Very similar.. - rjonesdj 2 years ago
    • The above was received as information from a customer at the US UserKon in New Orleans last year, I don't know where they got it, so it is possible ¯\_(ツ)_/¯ - cserrins 2 years ago
  • Aha! So what If I already captured C and S (like I did last year)? There's functionally nothing wrong with the image, other than the fact that 2 windows boot manager entries appear in BIOS. I wouldn't mind except that I've set up the boot sequence to prioritize NIC IPv4, then 6, then WBM, in case we use WOL w/PXE later on, and the new entry usurps the sequence by taking priority 0. ...Sigh, wish I'd read this first! - tkeyes 2 years ago
    • Before these advanced scripts appeared, we pulled a simpler couple from ITN for UEFI. Maybe I can just tweak them...

      CREATE:
      Select disk 0
      Clean
      Convert gpt
      Create partition efi size=200
      Assign letter=s
      Format quick fs=FAT32
      Create partition msr size=128
      Create partition primary
      Assign letter=c
      Format quick fs=NTFS
      Exit

      APPLY:
      bcdedit /set {bootmgr} device partition=s:
      bcdedit /set {memdiag} device partition=s:
      bcdedit /set {default} device partition=c:
      bcdedit /set {default} osdevice partition=c:
      Bcdedit /set {FWbootmgr} displayorder {Bootmgr} /addfirst - tkeyes 2 years ago
  • Can this script be modified to include the recovery Partition as well? If so could someone post it? - TMotto 2 years ago
    • It could, but we would need more information about it to help. But why would you want to capture a recovery partition? - cserrins 2 years ago
      • Not capture, but create, this partition is required by BitLocker, otherwise what would be an auto encrypt process becomes manual because you have to repartition the OS drive to enable this partition. - TMotto 2 years ago
  • I received some newer pc's that have a SSD drive listed as drive 1 and a 2 TB 7200 drive as drive 0. I have modified the task to reflect drive 1 but the apply image task fails. When I pull up a command prompt disk part shows that the drive has not been formatted so 0 space is available. If I run all of the commands listed in the batch file it works as expected. What am I doing wrong? Do I need to edit anything else besides the select drive piece? - rypalcovic 2 years ago
    • You probably need to change the drive letters, the drive letter of the image being deployed needs to match the drive letter on disk it is being installed onto. - cserrins 2 years ago
      • It's the same exact task I use on my other machines and the drive letters are identical. Also if I manually type out the commands from the task it works fine and the image will apply just fine. The only part I don't type out is the @echo off
        wpeutil UpdateBootInfo
        for /f "tokens=2* delims= " %%A in ('reg query HKLM\System\CurrentControlSet\Control /v PEFirmwareType') DO SET FIRMWARE=%%B
        echo Firmware Type: %FIRMWARE%
        echo Explanation of Firmware Type: (0x1 is BIOS, 0x2 is UEFI)
        if %FIRMWARE%==0x1 goto BIOS
        if %FIRMWARE%==0x2 goto UEFI
        goto END

        The rest of the script works fine by manual entry. - rypalcovic 2 years ago
This post is locked
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ