MDT 2010: Setting the default Computername

Most organisations have some sort of PC naming convention in place. Sometimes the human factor can mess it up. Fortunately, MDT can provide semi or full automation as required.

In the customsettings.ini type:

SkipComputerName=NO
OSDComputerName=PC_%SerialNumber%

In this example, the SkipComputerName is set to NO so a value can be set and  changed during LTI deployment using the wizard pane. Setting the value to YES will hide the computername wizard pane so the value set in OSDComputername will be forced.

The OSDComputername setting contains the name that the computer will be called during the deployment. You are able to use a combination of settings/values. The example above will build the pc (in my case) as PC_G183F7K.

You can use a mixture of variables and ASCII key combinations to construct your computername as your organisation dictates. More variable examples can be found in  the variables.dat file, but here are a few that could be useful in computer naming:

“ARCHITECTURE”=X86
“SERIALNUMBER”=G183F7K
“MAKE”=Dell Inc.
“MODEL”=Latitude D610
“PRODUCT”=0M7181
“ASSETTAG”=

About Andrew Barnes

A Scripting and Deployment Specialist.
This entry was posted in MDT 2010 and tagged , , , , , , . Bookmark the permalink.

40 Responses to MDT 2010: Setting the default Computername

  1. Alton Henley says:

    How do I get MDT 2010 to ask what the asset tag is?

    Like

  2. Michael Fonteyn says:

    Hello Andrew,

    i look for a solution to enter a Registered Owner and Registered Company every deployment in MDT 2010? Best way to do this in custom wizard page! I found nothing…

    regards Michael Fonteyn

    Like

  3. Craig says:

    I’m trying to deploy to a mixed physical / VM environment using the serial number for the OSDComputername.
    However, on my VMs (VM Ware) the VM serial number is full of spaces. is there a way to stripe out the spaces on the fly?

    Like

    • Hi Craig, the answer is yes, there’s a number of ways to tackle this issue.
      Try this line in your customsettings.ini

      OSDComputerName=#Mid(Replace(Replace(oEnvironment.Item(“SerialNumber”),” “,””),”-“,””),7,15)#

      If it looks scary dont be. I’ve written an article for you explaining how I dealt with this issue. I’ll publish it in the morning.

      Like

  4. Naveed Anwar says:

    Hi Andrew!
    I found your post very helpful, thnaks for sharing!
    I have a scenario where I have NOT to use MDT /SCCM just standalone installation with Unattend.xml file … but at the same time I need to have PC name as Serial Number.
    OR in other words, I would like to achine the following without MDT /SCCM.
    OSDComputerName=PC_%SerialNumber%

    Like

  5. Itay says:

    Hi Andrew!,

    Nice blog! i have learned a lot from you.
    I have one question that I want to ask you, maybe you can assist.

    already I have MDT task with zero touch settings that is working and including joining my domain.

    I want to be able during the OSD to tell it who is the user (domain user) and that it will set the computer name same as the user that i will provide and also will add that user to the local admin group.

    Is this something that is possible?

    Thanks!

    Like

  6. Amy says:

    Junk! I know of no-one who uses serial number for comp name! EVERY org uses PC naming that relates to location, Room17,, PC17. LAB50, PC-50. etc.

    Like

    • Junk? Perhaps you need to get around more. I’ve been in IT for 20 years. I’ve seen asset tags, mac addresses, complex variations including locations, you name it.

      My current employer uses MAC addresses and has 450,000 clients worldwide.

      Anyway, you’re missing the point, the above is a working example that can be expanded upon.

      There is no way to automate a computername using a room number so I think the whole point of ‘Automation’ has gone right above your tiny head.

      Liked by 1 person

    • Adam Stranger says:

      Super smart. And if you move your computer you rename it? How do you do asset inventory, by rooms or by asset tag?

      Like

      • If you have an IP scope per room then this would be easy. I’ve written a post called targeting lite-touch deployments that should help. I’m not a fan of location based naming though. it’s not suitable for today’s mobile workforce.

        Like

  7. Adam Stranger says:

    I have a naming convention based on Site-%SerialNumber%, it works fine. My problem is that some times a user will go to another site ans have is laptop (XP) plugged in, and get th enext OS schedule which will put him in the site he is deployed from. How can I do this?
    If current host NY-Something OSDComputerName=NY-%SerialNumber%
    also
    If current host NP-Something OSDComputerName=NY-%SerialNumber%
    but
    If current host LA-something new OSDComputerName=LA-%SerialNumber%
    and
    If none of the above applies, make it based on the subnet, which is what I have working now.

    thanks for any help.

    Like

  8. Natalie says:

    Hey there! I am using an unattended file for my deployments. I have everything working except the auto Computername. We used to take advantage of the directory services tab in WDS. Now, that isn’t working, I am trying to set my Computername field with my unattend file to MC%MAC (which is how we had it set in the directory services tab) and it keeps error-ing out. If I set it to a static name it is fine. Any idea how to do this? Thanks!

    Like

  9. Lewis says:

    I’m trying to add the computer to the domain and name the computer the same as what I put in the “NAME AND APPROVE” part. Can anyone help? This has been driving me crazy

    Like

  10. Nall White says:

    Question for you. I was able name the partition via OSDComputerName=%SerialNumber% in the past. I’m now getting this error “Windows could not parse or process the unattended answer file for pass [specialize]. The setting specified in the answer file cannot be applied. The error was detected while processing settings for component [Microsoft-Windows-Shell-Setup].”. This was after updating MDT versions. Under Format and Partition disk task I’ve got OSDComputerName or the partition and the variable at the bottom of the tab and for the variable on the Install Operation System task. When I remove this and put back OSDisk. Everything works. I’m running MDT 2013 and rebuilt everything. Still happening. What am I doing wrong? Oh, and your site helped be learn MDT from scratch. Thanks.

    Like

  11. Rhys says:

    Hi Andrew,

    I’d like the client PC to prompt the user for the name to be typed in and then join the domain with that name. How would I go about doing this?

    Thankyou

    Like

  12. Ken Murphy says:

    This is exactly what I’ve been looking for. I used OSDComputerName=PC_%SerialNumber% and it worked perfectly. But the Consultant that did the original build did it using only the last 5 of the serial number. I’d like to keep with the current pattern but I can’t figure this one out.

    Like

  13. Jayden says:

    Hi,

    Thanks for the info, Would it be possible to automate having a D or a L depending if its a notebook or desktop? so for a desktop it would automate %SerialNumber%D and a laptop would be %SerialNumber%L.

    Like

  14. Patrick K Marwizi says:

    Hi,

    I am looking for a naming convention like this: Sitename_Nummber eg PTA_001 but the number has to increment to the next number whenever I deploy a new machine in mdt 2013

    Like

  15. Jason says:

    Say i enter OSDComputerName-CHQ-%SerialNumber%
    Is there a way to keep them from changing the CHQ- portion?

    Like

  16. Andy P says:

    How can I get MDT to add the Serial Number to the description of the Computer in AD?

    Thanks!

    Like

  17. Lee says:

    Hi,
    Is it possible for MDT to use a partial asset tag as the computer name.
    Example: Asset tag in bios might be A012345

    Our naming convention for computer name is M laptops and D for desktops. Can MDT automaticallty detect if it is a laptop and then strip the A out and replace it with device type so it would be M012345 for a laptop or D012345 for a desktop? To go even further could it strip the 0 out as well but onlyif is is at the start of the asset tag?

    Like

  18. tarik dinc says:

    Hello Andrew. I wonder is it possible to OSDComputerName can be set via Microsoft Deployment Services?

    Like

  19. Pierre says:

    Stupid question “OSDComputerName=PC_%SerialNumber%” is pulling from the serial number off the bios?

    Like

Leave a comment