Instead of generating a random name during OSD deployment, you might want to enter a custom name to your computers. This is very easy to do with a PowerShell script now that WinPE 4.0 and later support PowerShell.

The method do have some requirements though, which are:

  • You will need to have MDT 2012 Integration in your SCCM Server. The Script will use ServiceUI.exe which is part of MDT. You will need to copy the binary with same architecture as your boot image.
  • Your boot image must support the use of Microsoft .NET (WinPE-NetFx) & Windows PowerShell (WinPE-PowerShell). So you will need to create a custom boot image, instead of using the   original ones.

Next step is to create the script. Lets name it OSDComputerNamePrompt.ps1

The script itself looks like this:

You can download the script from HERE

Next step is to obtain the ServiceUI.exe, the binary can be found in these locations, depending of the architecture:

C:\Program Files\Microsoft Deployment Toolkit\Templates\Distribution\Tools\x64
C:\Program Files\Microsoft Deployment Toolkit\Templates\Distribution\Tools\x86

Next thing to do, is to create a package to your SCCM. No need to add any programs.

To implement the script in your task sequence, you will need to place the package between the “Partition Disk” and “Apply Operating System” steps.

The command itself is:

During installation, the Computername prompt will look like this:

All the credits for this great script goes to Microsoft MVP Nickolaj Andersen