Setting Computer Name automatically during OSD Process using SCCM and MDT

Setting Computer Name automatically during OSD Process
Setting Computer Name automatically during OSD Process

Estimated reading time: 5 minutes

We have been looking into getting our OSD process to automatically change the computer name to what we want it to be for a while now but never really had much luck with it.

Reading various forums and blogs, many people have said to use WSNAME and many others saying use scripts, all of which never seemed to quite work for us.

What we wanted was a three letter prefix with the serial/tag number of our machines. Most of our machines (99%) are Dell’s and we wanted to use the 7 digit asset tag with a 3 letter prefix but things like the WSNAME only seemed to work with our HP’s using the %SERIALNUM% variable. Using this method, all our Dell machines were reporting the %SERIALNUM% as blank, so instead of:

ABC6TQX8X1

It came out as just:

ABC

Not really much use!

So, we decided that we really needed to spend some time on this and get it working once and for all. After actually dedicating some time to it instead of just messing about with it for five minutes here and there, we finally got it working.

For those of you that know MDT, we used this with a mixture of Gather and Set Task Sequence Variable. Tested it, works a treat!

So, a quick how to guide for those wanting to know how to do it as we have really struggled to find a simple step by step guide to doing such a simple task.

Prerequisites

We do assume that you have a good understanding of both MDT and SCCM at this point. You also need to have MDT installed and integrated into SCCM. If you need to create the MDT package, please read the next section, if not, jump to the instructions section.

MDT Package Creation

The easiest way to create the MDT package is after you have integrated MDT into your SCCM. Go ahead and right click on your Task Sequences and select Create MDT Task Sequence.

Create MDT Package
Create MDT Package

Run through the wizard and just create any old task sequence – you can delete the task sequence after.

Part of creating the MDT task sequence is to create the MDT package if you have not already done so.

Once complete, the MDT package then needs to be deployed and you should then be able to use it within your other task sequences.

Instructions

First of all, you need to have MDT installed. You also need to make sure that you have ConfigMgr integration working, please note that this guide does assume that you have MDT fully up and running to use in your Task Sequences within ConfigMgr.

if you need to know how to get this to work, leave a comment at the bottom of this post and we will look at getting a guide uploaded for doing that….

Edit your selected Task Sequence and just after the Deploy OS step, add your Use MDT Package step:

SCCM Task Sequence

Then, directly after this step, add the Gather step and set it to Gather only local data (do not process rules)

SCCM Task Sequence

Then, the final bit which applies the computer name, add Set Task Sequence Variable then make sure that the Task Sequence Variable is set to OSDComputerName. The value can be whatever you want it to be, the standard is:

%SERIALNUMBER%
SCCM Task Sequence

This will set the computer name as the, you guessed it, Serial Number.

If you want to customise it slightly, just add the text before the %SERIALNUMBER%, so as an example:

ABC%SERIALNUMBER%
SCCM Task Sequence

Save your task sequence and it should work.

Few things to remember that are very important, this part must be added AFTER the Deploy OS step, but also BEFORE the Apply Windows Settings step.

Feedback

We would love to hear your feedback on this article so come and join us on Facebook or Twitter and let us know what you think!

FAQ

What is the role of the ‘Gather’ step in the task sequence

The ‘Gather’ step is set to gather only local data without processing rules, which helps in collecting necessary information for the task sequence.

What should the Task Sequence Variable be set to for naming computers?

The Task Sequence Variable should be set to OSDComputerName, and the value can be %SERIALNUMBER% or a customized format like ABC%SERIALNUMBER%.

Where should the ‘Set Task Sequence Variable’ step be placed in the task sequence?

It should be placed after the Deploy OS step but before the Apply Windows Settings step.

Glossary

OSD (Operating System Deployment): The process of deploying operating systems to computers, often automated through tools like MDT and SCCM.

MDT (Microsoft Deployment Toolkit): A free tool from Microsoft that helps automate the deployment of Windows operating systems.

SCCM (System Center Configuration Manager): A software management suite from Microsoft that allows users to manage large groups of computers running various operating systems.

WSNAME: A tool used to rename Windows computers, capable of using variables like %SERIALNUM% to generate names.

Task Sequence: A series of steps executed in a specific order to automate processes such as operating system deployment.

%SERIALNUM%: A variable used to pull the serial number of a machine, often used in naming conventions.

Asset Tag: A unique identifier assigned to a piece of equipment for inventory tracking and management.

Gather Step: A step in MDT task sequences used to collect information from the local environment.

Set Task Sequence Variable: A step in MDT task sequences that assigns a value to a variable, such as setting the computer name.

Deploy OS Step: A step in MDT task sequences that handles the deployment of the operating system to the target machine.

Apply Windows Settings Step: A step in MDT task sequences where Windows settings are applied, including computer name, network settings, and more.

Share this content:

Click to rate this post!
[Total: 1 Average: 5]
Avatar for Andrew Armstrong

About Andrew Armstrong

Founder of TechyGeeksHome and Head Editor for over 15 years! IT expert in multiple areas for over 26 years. Sharing experience and knowledge whenever possible! Making IT Happen.

View all posts by Andrew Armstrong

19 Comments on “Setting Computer Name automatically during OSD Process using SCCM and MDT”

  1. how to set computer name based on country code GUI popup , device (desktop, laptop, VM) followed by 6 digit serial number
    USVM123456

  2. Is there an easy way to change the beginning letters? We use department code and serial, so like XY-2UA….for accounting department for instance, whereas hr would be HR-2UA… etc
    Thanks!

  3. I have installed MDT plus also integrate with SCCM now please let me know that how I use MDT tool Kit pakage in it

  4. Put this into my Task Sequence and works so huge thanks for this. However I have used the asset tag instead of serial number. I need to trim the length of the digits held in this as it names the machine as LP-00009821 and I would like it be named LP-9821. Any ideas on how I would achieve this?

  5. Put this into my Task Sequence and works so huge thanks for this. However I have used the asset tag instead of serial number. I need to trim the length of the digits held in this as it names the machine as LP-00009821 and I would like it be named LP-9821. Any ideas on how I would achieve this?

  6. So where am I suposed to find the MDT toolkit package for the step of “Use MDT package” I’ve looked online, and so far it seems to say its suposed to be created automatically when you integrate the MDT to your SCCM. Do you know if there is a way to create it manually, it seems the package was not created for me.

    1. The easiest way to create the MDT package is after you have integrated MDT into your SCCM, Go ahead and right click on your Task Sequences and select Create MDT Task Sequence. Run through the wizard and just create any old task sequence. But, part of that is to create the MDT package, that then needs to be deployed and you should then be able to use it.

  7. So where am I suposed to find the MDT toolkit package for the step of “Use MDT package” I’ve looked online, and so far it seems to say its suposed to be created automatically when you integrate the MDT to your SCCM. Do you know if there is a way to create it manually, it seems the package was not created for me.

    1. The easiest way to create the MDT package is after you have integrated MDT into your SCCM, Go ahead and right click on your Task Sequences and select Create MDT Task Sequence. Run through the wizard and just create any old task sequence. But, part of that is to create the MDT package, that then needs to be deployed and you should then be able to use it.

  8. I have installed MDT plus also integrate with SCCM now please let me know that how I use MDT tool Kit pakage in it

Leave a Reply

Your email address will not be published. Required fields are marked *