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”=
How do I get MDT 2010 to ask what the asset tag is?
LikeLike
Use the Property – AssetTag. MDT Collects this information for you. Have a read of my article here – http://wp.me/p1v18I-eD
LikeLike
Is it possible to get MDT to set this on a new machine that you don’t have a variables.dat for? For instance, can you say:
OSDComputerName=PC_%AssetTag%
…and get it to name a brand new machine?
LikeLike
Yes, that’s exactly how it works.
LikeLike
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
LikeLike
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?
LikeLike
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.
LikeLike
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%
LikeLike
Create a vb or powershell script for that mate.
LikeLike
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!
LikeLike
Hi there,
You should create a custom wizard pane for that, mate.
/Andrew
LikeLike
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.
LikeLike
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.
LikeLiked by 1 person
Super smart. And if you move your computer you rename it? How do you do asset inventory, by rooms or by asset tag?
LikeLike
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.
LikeLike
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.
LikeLike
Sorry Adam, That’s far beyond the scope of this simple post. This is just a getting started type post.
LikeLike
Adam, this is possible if you are using MDT. Create a different location record for each of your sites and set the OSDComputername to the desired template.
LikeLike
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!
LikeLike
In the customsettings.ini Set the value computername=MC%MACADDRESS001%
LikeLike
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
LikeLike
You have to forget that and use the wizards in MDT.
Only use WDS as a platform for booting.
LikeLike
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.
LikeLike
I think you should validate your answer file for errors using windows SIM. also check for invalid variables in the customsettings.ini
LikeLike
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
LikeLike
This is the default behavior of MDT. If you’re not seeing the wizard panes, remove the skip lines from your customsettings.ini
LikeLike
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.
LikeLike
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.
LikeLike
Yes Jayden I’ve written a post on that here.
LikeLike
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
LikeLike
Say i enter OSDComputerName-CHQ-%SerialNumber%
Is there a way to keep them from changing the CHQ- portion?
LikeLike
You would have to create a custom wizard pane for that.
LikeLike
How can I get MDT to add the Serial Number to the description of the Computer in AD?
Thanks!
LikeLike
You would need to create a custom VB script for that. There’s a few examples in previous posts here.
LikeLike
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?
LikeLike
Yes, you could write a user exit script to do all that. It’d be written in VB. There’s a few posts to get you started learning scripting for MDT here.
LikeLike
Hello Andrew. I wonder is it possible to OSDComputerName can be set via Microsoft Deployment Services?
LikeLike
Stupid question “OSDComputerName=PC_%SerialNumber%” is pulling from the serial number off the bios?
LikeLike
That’s correct. The %serialnumber% variable contains the value pulled from WMI WIN32_BIOS\SerialNumber.
LikeLike
Thanks
LikeLike