Setting Computer Name automatically during OSD Process – SCCM/ConfigMgr 2012

microsoft windows white logo

Last updated on March 30th, 2023 at 06:04 pm

Read Time:2 Minute, 32 Second

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.

First of all, you need to have MDT installed which you can download from here:

Download Latest MDT

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.

Setting Computer Name automatically during OSD Process - SCCM/ConfigMgr 2012 1

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

Setting Computer Name automatically during OSD Process - SCCM/ConfigMgr 2012 2

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%

Setting Computer Name automatically during OSD Process - SCCM/ConfigMgr 2012 3

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%

Setting Computer Name automatically during OSD Process - SCCM/ConfigMgr 2012 4

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.

Comments

If you have any problems please use our comments system below to leave a comment and we will get back to you as soon as we can.

Click to rate this post!
[Total: 1 Average: 5]

Free Subscription

If you want to be notified when we post more quality guides like this one, sign up to our free subscription service and you will receive an email when a new post is live.

Join 441 other subscribers.

No need to worry, we will not be filling your inbox with spam and you can unsubscribe anytime you like.


9 thoughts on “Setting Computer Name automatically during OSD Process – SCCM/ConfigMgr 2012

  1. Is there a list of other variables that can be used, aside from %SERIALNUMBER%? Can today’s date be used?

    1. There are a lot, when you run the Gather step, it runs the MDT script of ZTIGather.wsf. Also in the scripts folder is a file called ZTIGather.xml – this will list all the variables you can use from the Gather step.

  2. Is there a list of other variables that can be used, aside from %SERIALNUMBER%? Can today’s date be used?

    1. There are a lot, when you run the Gather step, it runs the MDT script of ZTIGather.wsf. Also in the scripts folder is a file called ZTIGather.xml – this will list all the variables you can use from the Gather step.

  3. Thanks for the info, but maybe I’m missing something. I can see OSDComputerName in this listing and it tells me what it does, but it doesnt list any other %(something)% variables in there. Is there a full list of those somewhere? Everywhere I search just comes up with %serialnumber% as the example and doesnt list any other options.

  4. Thanks for the info, but maybe I’m missing something. I can see OSDComputerName in this listing and it tells me what it does, but it doesnt list any other %(something)% variables in there. Is there a full list of those somewhere? Everywhere I search just comes up with %serialnumber% as the example and doesnt list any other options.

  5. Thanks for the info, but maybe I’m missing something. I can see OSDComputerName in this listing and it tells me what it does, but it doesnt list any other %(something)% variables in there. Is there a full list of those somewhere? Everywhere I search just comes up with %serialnumber% as the example and doesnt list any other options.

  6. Is there a list of other variables that can be used, aside from %SERIALNUMBER%? Can today’s date be used?

    1. There are a lot, when you run the Gather step, it runs the MDT script of ZTIGather.wsf. Also in the scripts folder is a file called ZTIGather.xml – this will list all the variables you can use from the Gather step.

Leave us a message...

This site uses Akismet to reduce spam. Learn how your comment data is processed.