Making MDT work with Windows ADK 2004 for BIOS Machines

Due to code changes in Windows ADK 10 v2004 the MDT utility (Microsoft.BDD.Utility.dll) that detects BIOS or UEFI firmware types no longer works correctly, and detects BIOS-based machines as UEFI-based machines.

Update June 3, 2020: Microsoft released a hotfix for this issue. Basically a new version of Microsoft.BDD.Utility.dll: With this hotfix you don't need the below workaround: https://support.microsoft.com/en-us/help/4564442/windows-10-deployments-fail-with-microsoft-deployment-toolkit

Note: This issue happens for ConfigMgr (SCCM) too, but has been addressed in the HFRU for ConfigMgr 1910, as well as in ConfigMgr 2002. Also Windows 10 v2004 has this code change (see Symptom #2 later in this post).

Symptom #1

Bare metal deployments will fail with the following error:

FAILURE ( 5616 ): 15299: Verify BCDBootEx
Litetouch deployment failed, Return Code = -2147467259 0x80004005
Failed to save environment to (80070057)

Deployments failing for BIOS-based machines

Symptom #2

Not related to ADK 2004, but the same code change was done in Windows 10 v2004 too. The Apply Windows PE (BCD) action may fail during build and capture of a Windows 10 v2004 reference image, and cause either the following error after reboot, or just an endless loop showing "Loading files…":

Status: 0xc0000001
Info: An unexpected error has occurred

Endless loop after restart from full Windows.

The Fix

Until an official fix is available, this temporary workaround gets the job done. Simply copy the below script to your deployment share scrips folder, and add it to your standard client task sequence in two locations:

  • #1 Prior to the actions that formats the drive in the Preinstall / New Computer only node.
  • #2 After the Apply Local GPO Package action.

Note: If using the separate sysprep and capture task sequence instead of a build and capture task sequence, add the script after the Set Phase action (see screenshot further down in this post). Thanks Sean Smith for providing that info.

https://github.com/DeploymentResearch/DRFiles/blob/master/Scripts/FixUEFIDetection.wsf

Name: Fix UEFI Detection
Command Line: cscript.exe "%SCRIPTROOT%\FixUEFIDetection.wsf"

Adding the FixUEFIDetection.wsf script to the first location in the task sequence
Adding the FixUEFIDetection.wsf script to the second location in the task sequence
The FixUEFIDetection.wsf script added to a sysprep and capture task sequence.

Troubleshooting

The script creates its own log file: FixUEFIDetection.log that can be used for troubleshooting. Or, simply add a pause before the script runs in the task sequence, and run it interactively via F8. Here is what I use to pause a task sequence (to resume, just exit the command prompt):

Action: Run Command Line
Name: Pause with Command prompt
Command Line: cmd /c start "cmd" /wait cmd

Pausing the task sequence by using a command prompt.
A paused task sequence.
About the author

Johan Arwidmark

5 6 votes
Article Rating
Subscribe
Notify of
guest
53 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
Dennis
Dennis
14 days ago

Hey Johan, thanks for the very informative article and for updating it with the hotfix information. I, too, was wracking my brains why I kept seeing a "Formatting UEFI" message on BIOS boot machines. Even after re-generating the boot image in the MDT console. Then it dawned on me: A reminder for those who use WDS to boot over the network– Please also import the boot image into WDS. WDS does not pick up the newly-generated boot image from MDT, obviously. 🙂

leo
leo
1 month ago

thanks! needed this fix even with the hotfix. Not for all devices, but some new specialized laptops (kano).

Edward
Edward
4 months ago

Hello Johan, I've hit a snag trying to deploy Win10 (20H2) build to a Dell OptiPlex 7070. We are running MDT 2013 and ADK 2004 and the WinPE add-on 2004. I installed the UEFI MDT patch. I have the latest Dell driver .cab imported to the server. I've updated the deployment share and re-generated the boot images at least 3 times. The image deploys fine and after the first reboot, the task sequence fails to resume with the error Unable to find definition file:BDD_WelcomeZ_ENU.xml. I've attached a screenshot of the error. Once I hit ok, it bumps me out to… Read more »

cetip_bdd_error.JPG
Clark
Clark
5 months ago

Hello Johan. I've worked IT for 30 years but only recently stood up a WDS/MDT server for the first time and hit this bug. I applied the MS patch but the problem persisted. So I backed that out and applied your fix. My deployment get through the first stage now but then I have an unbootable disk. Any thoughts on where I went wrong?

ovad
ovad
9 days ago

I have the same problem. After first reboot no boot device found. Partitions are created correctly. With real hotfix detection doesn't work correctly and it is still detecting UEFI true

Jonas Colin
Jonas Colin
5 months ago

Guys I am having almost the same problem, I am unable to capture a 20H2 image using Hyper-V with the latest MDT and ADK+WinPE. the process went fine but stuck in a loading file boot loop.

yaeslk
yaeslk
6 months ago

Hi Johan, thank you for the solution, I tried using the script and it didnt work for me. Here is the error I got. Failure Litetouch deployment failed, Retum Code -2147467259 Ox8000400S Failed to run the action: Fix uEFl Detection. Incorrect function. (Error. 00000001: Source: Window•s) The execution of the groik (Preinstall) has failed and the execution has been aborted. An action failed. Operation aborted (Error. 80004004; Source: Windows) Failed to run the last action: Fix UEFI Detection. Execution of task sequence failed.  I saw from comments that there is a hotfix for MDT fixes the issue. Can someone provide… Read more »

Last edited 6 months ago by yaeslk
Colin
Colin
7 months ago

Quality Microsoft QA work with recent MDT releases. First WISM needed a slapdash hotfix, now BDD breaks in 8456. What's next, a hotfix to be able to properly partition and format a disk?

Jan Spetsare
Jan Spetsare
7 months ago

Thank You for the solution!!

chris
chris
8 months ago

Sweet jeebus, thank you for this! Been banging my head against the wall for the better part of a day figuring I had screwed up somewhere.

David
David
8 months ago

Working for me now with the June 2020 Hotfix. Thanks for posting this

Andy Sharp
Andy Sharp
8 months ago

Genius, thanks ever so much.

Owen
Owen
9 months ago

Fantastic stuff. I've been pulling my hair out here – I found your post early on but the hotfix was out. Applied that and updated the deployment share. No luck! That's after forcing a MBR (BIOS only) step in the task sequence. I have lots of old BIOS machines so can't manage with UEFI only.
I kept coming back to the same few posts online. In the end, tried with your script in there too, and it's progressed!
Perhaps I've not installed the hotfix correctly? It's straightforward but maybe December has taken its toll on my brain.

allan stewart
allan stewart
9 months ago

Just wanted to say thanks for this.
Had this issue today when imaging some older laptops. Saved me a lot of time

Harvey
Harvey
9 months ago

Thanks Johan, this script fixed it for me.

Chad
Chad
9 months ago

I am deploying Server 2016 DataCenter GUI with Litetouch. However the fix doesn't work. Would you know why?
I have applied the fix to the server 2019 task sequences and they are working.

Kev
Kev
10 months ago

thank you so much!!

Robert Bigelow
Robert Bigelow
10 months ago

We skipped v2004, and I found this post when I ran into this problem building the image for v20H2. I first applied the hotfix from Microsoft, and it still detected my Generation 1 Hyper-V VM as UEFI. I undid the hot fix and tried your fix, it failed as well.

I ended up manually setting the IsUEFI Task Sequence Variable to False. That got me past the first stage, it formatted BIOS correctly, but after sysprep, it did that loop thing.

So I added the Set Task Sequence step right before Imaging, just like your script call.

James
James
9 months ago

I have just run into this issue trying to create a reference image for Win 10 20H2. I've used MS hotfix to replace the DLLs in both the deployment share and regenerated the boot images, but I am still in the reboot loop.

I will try Rob's suggestion and see if that works.

Zain K
Zain K
10 months ago

Thanks Johan your fix worked for Win10 v2009 Image capture! Please keep up the good work, a very valuable resource for OSD folks. 🙂

Last edited 10 months ago by Zain K
Thomas
Thomas
1 year ago

So I applied the hotfix, but seems like it made it worse in my case. Before the hotfix I had to mount my capture iso and boot from that when I wanted to capture, was caught in a loading loop otherwise, after the hotfix instead of rebooting before going into PE and capture my VM bluescreens and reboots, getting into the error that something went wrong and I should reinstall the OS. Followed the guidelinkes from the link to see if I missed something, but followed it like it were described.
 
 

AlektroNik
AlektroNik
1 year ago

Thanks for the link to the patch;)
 
You did not encounter a problem that on Vmware ESXi virtual machines during deployment refuse to see the hard drive … even if you integrate the drivers into WinPE Boot Image through MDT?
I tried different versions of SCSI controllers, HDD does not help anything. There were no such problems on WinPE Windows 8.1.

Last edited 1 year ago by AlektroNik
Holger Dijkstra
Holger Dijkstra
1 year ago

Hi Johan! I have been trying to do a build and capture of Windows 10 2004 with MDT 8456 and HypoerV, and with the help of this solution I was able to get it done, thanks!. BUT I noticed that when the Install Update step is running som updates are found, i.e Silverlight, and Windows Defender update, but all are set to be SKIP'ped in the log files…. Have you seen this behaviour and maybe have a clue on how to remediate it? I am updating towards Microsoft Update, and not using a WSUS server. Thanks!

Holger Dijkstra
Holger Dijkstra
1 year ago

Hi Johan! No problem… I figured it out though. One way or another, it looks to me that Windows 10 2004 updates are flagged as if they are set up to Request user input…. So when I comment out line 298 in ZTIWindowsUpdate.wsf the updates are detected and installed as they are supposed to be…. What do you know 🙂

Sean Smith
Sean Smith
1 year ago

I apologize to all. I figured I would share the good news. Johan's script works great for captures if you place the script near the top of a standard "sysprep and capture" task sequence, within the "Capture Image" folder. I put his script below "Set Phase" task and above "Configure" task. Ran like a charm!!!! Thanks for the awesome fix! At this point, I guess the other posts are pointless.

2020-05-29_23-11-59.png
Sean Smith
Sean Smith
1 year ago

Sounds good. Glad I could help and contribute.

Sean Smith
Sean Smith
1 year ago

Sorry…last post for now. The first attempt failed so I moved the task below "Apply Windows PE (BCD) and above "Restart computer". It errored out saying it was looking for a LTICleanup.wsf script file?

Sean Smith
Sean Smith
1 year ago

I took a stab at it and testing now. I also attempted to upload a screenshot, but it did not work out so well. I put your WSF code underneath "Capture Image" folder –> below "Execute Sysprep" and above the "Apply Windows PE (BCD)" task. I have a pretty vanilla capture and sysprep task sequence for reference.

Last edited 1 year ago by Sean Smith
Sean Smith
Sean Smith
1 year ago

Johan,

I am trying to capture a Win 10 2004 WIM, but not sure where the best place to put this script would be. Any guidance? I see that your screenshots are for deployment task sequences, but I never saw a capture and sysprep task sequence screenshot.

Last edited 1 year ago by Sean Smith
John
John
1 year ago

Johan, you are simply the best. Thank you!

Martin
Martin
1 year ago

Is it the same issue when deploying servers (2019 and 2016) with MDT and ADK 2004?

RPNZ
RPNZ
1 year ago

Ran into this yesterday and been hunting for a fix, will give this a try – thanks!

Daniel Fernström
Daniel Fernström
1 year ago

In full OS after Gather step Microsoft.BDD.Utility.dll kicks in again and set IsUEFI = true

So if you build ref images on gen1 VM (BIOS) you also have to set IsUEFI = false in full OS

I did it with a powershell script:

Not sure if BIOS/UEFI detection is awesome but it works

$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment

$boottype = (Select-String 'Detected boot environment' C:\Windows\Panther\setupact.log -AllMatches ).line -replace '.*:\s+'

if ($boottype -eq 'EFI')

{$TSEnv.Value("IsUEFI") = "true"}

else

{$TSEnv.Value("IsUEFI") = "false"}

Daniel Wahlfridsson
Daniel Wahlfridsson
1 year ago

Tack för lösningen Johan!

Last edited 1 year ago by Daniel Wahlfridsson
Jim
Jim
1 year ago

Great post – thank you – it saves me time


>