We currently have MDT integration with Configuration Manager, however due to Microsoft no longer developing MDT and vbscript being removed in the future, I've being reviewing our Task Sequences. I've been able to remove MDT from the base metal pxe boot TS and it works, however we also use the Refresh Only part of the MDT TS which as an 0x80070057 when the TS starts the Apply Operating System. I've replaced the MDT Gather task with powershell script from GitHub - jonconwayuk/PowerShell_Gather: PowerShell script to replace MDT Gather in Windows OSD which doesn't work. The TS only works if I add the Use Toolkit Package and Gather tasks for MDT which then allows the TS to wipe the C drive and apply the wim file.
I presume the MDT Gather is setting a variable that the Powershell script doesn't.