When you install new computers it would be nice to be able to easily name the computer as part of the deployment, otherwise the new computer could end up with a name like MININT-XRGHJTF unless you import it into Configuration Manager first. You can script around this in your task sequence or use web services or HTA’s but the easiest method of all is to set a Collection variable called OSDComputerName. This method does not require any scripting all you need to do is to Enable Unknown Computer support in the Distribution Point PXE tab settings.
To prompt the end user to enter a computer name In Configuration Manager 2012 by using the OSDComputerName variable you first need to think about the computers you are aiming this at, and in this case the computers are unknown computers, that is, they are unknown to Configuration Manager.
Step 1. add the collection variable
Now that we know that they are unknown we need to select the Unknown Computers collection called All Unknown Computers. Right click and choose Properties.
select the Collection Variables tab and click on the Yellow star burst button as shown below
enter the following variable name when prompted OSDComputerName, remove the checkmark from Do Not Display this value in the Configuration Manager console as in the screenshot below
click ok and apply so that it looks like this
Step 2. Make sure you have Deployed a task sequence to the Unknown Computers collection
Verify that you have deployed your chosen task sequence to the Unknown Computers collection by selecting the task sequence and clicking on the Deployments tab. The deployments listed should include one for the All Unknown Computers collection as shown below. If not, then create a new deployment for the task sequence and choose the All Unknown Computers collection for that deployment.
Step 3. PXE boot a new computer
PXE boot a new computer. Press F12 when prompted
Note: make sure the computer is NOT present in Configuration Manager prior to this, either as a previous computername or as an UNKNOWN object, if it is, highlight it in All Systems and delete it.
select your task sequence and click next
now you will see a Task Sequence window called Edit Task Sequence Variables
double click on OSDComputerName, the following should appear
type in a computername
click ok and the computername value should be listed to the right of the variable name as shown below
click next and the task sequence completes as normal
Step 4. Verify that it worked
Now that the Task Sequence is complete you can logon to your computer, bring up the computer properties and note the computername is what you entered earlier.
the variable is set during the Apply Windows settings step of the task sequence and you can see the collection variable being added in the SMSTS.log file (found in C:\Windows\CCM\Logs)
that’s it, I told you it was easy !