You ever had it when a machine needs to be rebuilt because it's either crashed completely or is suffering issues that you know, deep down in your technical heart, a rebuild will sort it all out.
So what do you do?
You press that magical network boot key, PXE boot that machine and start the MDT process. Fantastic, you the go through the wizards to eventually get to the "Computer Name" stage where it then prepopulates the name with a MiniNT name and you go.. hmm.. bugger what the name of the machine again?
You look for a sticker, which has obviously fallen off or worn away, you think i'll need to reboot to get to the login screen to find the name there.. which isn't an option if the machine is totally broke.
Wouldn't it be nice to have the machine put in its actual, existing name in place of that MiniNT name, still editable if required, but there for a reference at least. Well you can, using some minor trickery and awesomeness.
Thanks to Michael Klinteberg from Technet forums, a simple script copied into the Scripts folder in your deploymentshare and two lines added to your customsettings.ini file will give you the desired effect.
Copy the below script into notepad and save it as "UserExit.vbs"
Function UserExit(sType, sWhen, sDetail, bSkip) oLogging.CreateEntry "entered UserExit ", LogTypeInfo UserExit = Success End Function Function GetOfflineComputername() On Error Goto 0 If oEnvironment.Item("OSVERSION")="WinPE" Then Dim CompName : CompName = "" Dim ret, sOldSystem : sOldSystem = "" For Each drv In Array("C", "D", "E", "F") If ofso.FileExists(drv & ":\windows\system32\config\system") Then sOldSystem = drv & ":\windows\system32\config\system" Exit For End If Next oLogging.CreateEntry "Mounting Offline registry " & sOldSystem, LogTypeInfo ret = oShell.Run ("reg load HKLM\z " & sOldSystem, 0, True) If ret = 0 Then CompName = oShell.RegRead("HKLM\z\ControlSet001\Services\Tcpip\Parameters\Hostname") If CompName <> "" Then oLogging.CreateEntry "Found old computername '" & CompName & "'", LogTypeInfo Else oLogging.CreateEntry "Old computername name could not be found", LogTypeWarning End If Else oLogging.CreateEntry "Could not mount offline registry " & sOldSystem, LogTypeWarning End If oShell.Run "REG UNLOAD HKLM\Z", 0, True Else CompName = oShell.ExpandEnvironmentStrings("%Computername%") End If GetOfflineComputername = CStr(CompName) End Function