Skip to content

How to build naming convention within OSD

Featured Replies

I'm trying to automate our computer deployment completely.

At the moment the helpdesk guys have to manually type in the name of the machine to a fairly simple naming convention which follows:

 

XX-YY-Username

 

Where XX is one of 3 brand initials, YY is either WS or LT depending on desktop/laptop and Username is the user's name.

 

Unfortunately this isn't being followed correctly so I'd like to automate it and change it around a bit going forward so that instead of using the Username I use the service tag of the machine.

I think I have the bits together to get the YY-ServiceTag but I'm really struggling on how to get the support guys to choose the brand.

 

Can anyone point me at an idiot proof guide to get his running, I've spent far too long googling for options and just can't figure out how to get it working.

 

Hi papa,

i would suggest to use the Microsoft Deployment Toolkit. Here is Nialls Howto for Integration.
If you read thru and finish the Integration, here is a customsettings.ini example which will create a Computer Name according to your Needs.

 

Of course you have to fill up additional sections for your Hardware types and to remove the Gigabyte section (probably not the Lenovo section)

Also use the Serial number instead of the asset tag, which is not always filled.

[Settings]
Priority=Desktop,Default
Properties=MyModel,MyType

[Default]
Mytype=LP
MyModel=%MAKE%
OSDComputerName=#Replace("#Left("%MYMODEL%",2)#"," ","")#-%MYTYPE%-#Replace("#Left("%SERIALNUMBER%",7)#"," ","")#
Subsection=%MAKE%

[Desktop]
Subsection=Desktop-%IsDesktop%

[Desktop-True]
MyType=WS

[Gigabyte Technology Co., Ltd.]
MyModel=GT

[LENOVO]
MyModel=LV

Run the following from an administrative command prompt:

 

wmic /namespace:\\root\cimv2 path win32_computersystem get manufacturer

 

It should return your Mfg information.

 

As a .vbs you could do something like (I apolgize for the sloppy coding):

 

strComputer = "."
Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strcomputer & "\root\cimv2")

Set colItems = objWMIService.ExecQuery("Select * From Win32_SystemEnclosure")

For Each objItem in colItems

strComputerManufacturer = objitem.Manufacturer ' This should be the name you are looking for

strSMBIOSAssetTag = objitem.SMBIOSAssetTag ' This will return a value if it is set (YMMV as Peter33 notes above)

strSerialNumber = objitem.SerialNumber

Next

 

'WScript.Echo "Manufacturer: " & strComputerManufacturer
'WScript.Echo "Asset Tag: "& strSMBIOSAssetTag
'WScript.Echo "Serial Number: " & strSerialNumber

 

If strComputerManufacturer = "HP" or strComputerManufacturer = "Hewlett-Packard" Then
strComputerManufacturer = "HP"
XX = strComputerManufacturer
ElseIf strComputerManufacturer = "Dell Inc" Then
strComputerManufacturer = "DL"
XX = strComputerManufacturer
ElseIf strComputerManufacturer = "Lenovo" Then
strComputerManufacturer = "LN"
XX = strComputerManufacturer
Else strComputerManufacturer = "??"
End If

 

ZZ = strSMBIOSAssetTag
SN = strSerialNumber

 

WScript.Echo "Mfg: " & XX
WScript.Echo "Asset: " & ZZ
WScript.Echo "Serial: " & SN

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.