The CoreTech OSD HTA wizard is a very useful front-end for SCCM OSD operations. Unfortunately, as delivered by CoreTech, it only works on 32-bit Windows PE. To fix that, on a computer, run the OSD wizard by using the StartHTA.vbs in the OSDHTA\HTA folder. While the wizard is running, go to your %TEMP% folder and locate a folder labeled as a GUID string. The unpacked OSD HTA files will be in there. Copy those out to a more permanent share location that you can build an SCCM standard package with (and then you can terminate the HTA wizard running in the background).

Create a new script (in my case, I call it Run.vbs) based on the code below. Adjust the username/password/share location for the share of the CoreTech OSDHTA\HTA\Config folder. Because this script contains a username and password, I use the VBScript encryption tools to encrypt it and only place the final Run.vbe script into the SCCM package source folder. Then, when building the Windows PE image, include a prestart command that runs Cscript //nologo Run.vbe and references this package source as the files to include in the image.

Run.vbs

'General objects
Set wshShell = CreateObject("WScript.Shell")
Set wshNetwork = CreateObject("WScript.Network")
Set FSO = CreateObject("Scripting.FileSystemObject")
Set SO = WScript.StdOut
Set TSE = CreateObject("Microsoft.SMS.TSEnvironment")
Set WMI = GetObject("winmgmts://./root/cimv2")

'Search WMI for physical disks
Set Drives = WMI.ExecQuery("Select * from Win32_DiskDrive")

'Check to make sure that we can see the physical disk
If Drives.Count < 2 Then
  'See if we are booted using USB disk or no physical disks were found; in which case prompt for troubleshooting
  If TSE("_SMSTSLaunchMode") = "UFD" or TSE("_SMSTSLaunchMode") = "UFD+FORMAT" or Drives.Count = 0 Then
    MsgBox "It appears that the internal drive wasn't found.  Press F8 to troubleshoot and determine if an additional driver is required.  Pressing OK will shut down the computer.", (vbOKOnly + vbCritical), "Missing Internal Disk"
    WScript.Echo "Shutting down..."
    wshShell.Run "wpeutil shutdown",0,true
    WScript.Quit
  End If
End If

bInternalDiskHasC = False   'Used to verify that we see the C: drive letter assigned to the internal disk

'Grab physical disk 0 into oDrive; this _should_ be the internal boot drive
For each iDrive in Drives
  if iDrive.Name = "\\.\PHYSICALDRIVE0" Then Set oDrive = iDrive
Next

'If we couldn't get oDrive, then prompt for troubleshooting and shutdown
if oDrive is Nothing Then
  MsgBox "It appears tha tthe internal drive wasn't found.  Press F8 to troubleshoot and determine if an additional driver is required.  Pressing OK will shut down the computer.", (vbOKOnly + vbCritical), "Missing Internal Disk"
  WScript.Echo "Shutting down..."
  wshShell.Run "wpeutil shutdown",0,true
  WScript.Quit
end if

'If we have drive 0 but it is USB or external, we have a problem still; prompt for troubleshooting and shutdown
if oDrive.InterfaceType = "USB" or oDrive.MediaType = "External hard disk media" Then
  WScript.Echo "External drive is primary"
  MsgBox "The internal disk drive is not showing up as drive 0.  Press F8 to troubleshoot the cause.  You may need to go to UEFI setup to fix.  Pressing OK will reboot the computer.", (vbOKOnly + vbCritical), "Wrong Disk First"
  WScript.Echo "Shutting down..."
  wshShell.Run "wpeutil shutdown",0,true
  WScript.Quit
End If

'Check the partitions on the disk to get assigned volumes, looking for the C: volume; flip our flag if we find it on disk 0.
WScript.Echo "Looking at partitions on " & oDrive.Name
Set Partitions = oDrive.Associators_(,"Win32_DiskPartition")
For Each iPartition in Partitions
  Set LogicalDisks = iPartition.Associators_(,"Win32_LogicalDisk")
  If LogicalDisks.Count > 0 Then
    For Each LogicalDisk in LogicalDisks
      If LogicalDisk.DeviceID = "C:" Then bInternalDiskHasC = True
    Next
  End If
Next

'We found drive C: on the internal disk, so see if it is encrypted; if so, reformat it so that we can write to it during the task sequence
if bInternalDiskHasC Then
  WScript.Echo "C: found on the internal disk drive"
  Set BL = GetObject("winmgmts://./root/cimv2/security/microsoftvolumeencryption")
  Set EVs = BL.ExecQuery("Select * from Win32_EncryptableVolume where DriveLetter='C:'")
  If EVs.Count > 0 Then
    For Each EV in EVs
      If EV.EncryptionMethod <> 0 Then
        if MsgBox("It appears that the internal disk is encrypted.  The disk must be cleared before you will be able to reimage this computer.  Do you wish to clear the disk and reformat it before proceeding?", (vbYesNo + vbDefaultButton2 + vbQuestion), "Drive is Encrypted") = vbNo Then
          WScript.Echo "Shutting down..."
          wshShell.Run "wpeutil shutdown", 0, true
          WScript.Quit
        end if
        
        Set DP = FSO.CreateTextFile("X:\DP.txt")
        DP.WriteLine "select disk 0"
        DP.WriteLine "clean"
        DP.WriteLine "create partition primary size=65536"
        DP.WriteLine "format fs=ntfs quick label=TempOS"
        DP.WriteLine "assign letter=C"
        DP.Close
        Set DP = Nothing
        WScript.Echo "Repartitioning and reformatting the internal disk..."
        wshShell.Run "diskpart /s X:\DP.txt",0,true

        'We also need to clear the TPM of ownership before it can be reused
        Set TPMWMI = GetObject("winmgmts://./root/cimv2/security/microsofttpm")
        Set TPMs = TPMWMI.ExecQuery("Select * from Win32_TPM")
        If TPMs.Count = 0 Then
          'Hang on - we didn't find a TPM for some reason
          if msgBox("The TPM does not appear to be enabled (or one does not exist).  Press Yes to reboot and go into UEFI setup to enable it.  Press No to continue", (vbYesNo + vbDefaultButton2 + vbQuestion), "Enable TPM") = vbYes Then
            WScript.Echo "Restarting..."
            wshShell.Run "wpeutil reboot", 0, true
            WScript.Quit
          end if
        else
          For Each TPM in TPMs
            B = False : Msg = ""
            R = TPM.IsOwned(B)
            If B Then
              'Instruct the TPM to request reset of ownership and then reboot
              TPM.SetPhysicalPresenceRequest 14
              MsgBox "The computer will restart so that you can clear the TPM ownership."
              wshShell.Run "wpeutil reboot", 0, true
              WScript.quit
            End If
            R = TPM.IsActivated(B)
            'If the TPM is found but not active, prompt the user to activate it at the next boot up
            If Not B Then Msg = "TPM is not activated."
            If Not B Then TPM.SetPhysicalPresenceRequest 3
            R = TPM.IsEnabled(B)
            'If the TPM is found but not enabled, prompt the user to enable it at the next boot up
            If Not B Then Msg = "TPM is not enabled."
            If Not B Then TPM.SetPhysicalPresenceRequest 1
            If Msg <> "" Then
              If MsgBox(Msg & "  Press Yes to reboot and go into UEFI setup to enable it.  Press No to continue", (vbYesNo + vbDefaultButton2 + vbQuestion), "Enable TPM") = vbYes Then
                WScript.Echo "Restarting..."
                wshShell.Run "wpeutil reboot", 0, true
                WScript.Quit
              end If
            End If
          Next
        End If
        
      End If
    Next
  End If
Else
  'No C: found, which means that the disk has been cleared (and C: is likely assigned to the USB boot disk); format it and reboot so that it comes up cleanly
  If MsgBox("It appears that the internal disk has not been formatted.  This is required before you can image this computer.  Do you wish to clear the disk and reformat it (computer will reboot to restart the deployment tool)?", (vbYesNo + vbQuestion), "Blank Disk Detected") = vbNo Then
    WScript.Echo "Shutting down..."
    wshShell.Run "wpeutil shutdown",0,true
    WScript.Quit
  End if

  Set DP = FSO.CreateTextFIle("X:\DP.txt")
  DP.WriteLine "select disk 0"
  DP.WriteLine "clean"
  DP.WriteLine "create partition primary size=65536"
  DP.WriteLine "format fs=ntfs quick label=TempOS"
  DP.WriteLine "assign"
  DP.Close
  Set DP = Nothing
  WScript.Echo "Partitioning and formatting the internal disk..."
  wshShell.Run "diskpart /s X:\DP.txt",0,true
  WScript.Echo "Rebooting to restart the deployment wizard with proper drive letters..."
  wshShell.Run "wpeutil reboot",0,true
  WScript.Quit
End If

'Map a network drive to the SCCM server for configuration of the HTA wizard
'MODIFYTHIS
User = "DOMAIN\username"
Password = "password"
Config = "\\ServerFQDN\ShareName\CoreTech\OSDHTA\HTA"
DriveLetter = "T:"

WScript.Echo "Looking for existing drive mappings..."

Set oDrives = wshNetwork.EnumNetworkDrives
For i = 0 to oDrives.Count-1 Step 2
  WScript.Echo "Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1)
  if oDrives.Item(i) = DriveLetter Then
    wshNetwork.RemoveNetworkDrive DriveLetter, True, True
  end if
Next

WScript.Echo "Mapping configuration connection..."
wshNetwork.MapNetworkDrive DriveLetter, Config, False, User, Password

'Start up the install wizard
WScript.Echo "Starting Install Wizard..."
wshShell.Run "osd.hta """ & User & """ """ & Password & """ ""T:\Config""",0,true

'Monitor for the mshta process and wait for it to finish
WScript.Echo "Waiting for the Wizard to finish..."
Do
  WScript.Sleep 1000
  bRunning = False

  Set objWMIService = GetObject("winmgmts://./root/cimv2")
  Set colProcess = objWMIService.ExecQuery("select * from win32_process where name='mshta.exe'")
  For Each item in colProcess
    bRunning = True
  Next

Loop While bRunning

'Add a countdown of C seconds to make sure that SCCM processes assignments and offers properly for the next step
C = 45
WScript.Echo "Waiting for SCCM to complete assignments and other tasks..."
Do While C > 0
  SO.Write "Waiting " & C & " second(s)... " & Chr(13)
  WScript.Sleep 1000
  C = C - 1
Loop
WScript.Echo ""
WScript.Echo "Finished."

Be sure to encrypt this file as it will contain a username and password. Locate MODIFYTHIS to find where you need to make changes.