Scripted Naming PC using the Serial Number stored in WMI during ConfigMgr OSD Task Sequence
Create the following as a .vbs file and save it on your ConfigMgr PXE boot server in a share.
'************************************************************
set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & "." & "\root\cimv2")
set colSMBIOS = objWMIService.ExecQuery _
("Select * from Win32_SystemEnclosure")
For Each objSMBIOS in colSMBIOS
strNewName = objSMBIOS.SerialNumber
next
strNewName = "Z28-" & strNewName
SET env = CreateObject("Microsoft.SMS.TSEnvironment")
env("OSDCOMPUTERNAME") = strNewName
'*********************************************************
Then within your Task Sequence choose to Run Command Line right after the Restart in Windows PE.
This will cause the copmtuer being Imaged to get the serial number from WMI automatically and then prefix it with Z28.
So, if your Serial number as 000001 then the resulting PC name will be Z28-000001.
This is a very nice way to ensure all your Imaged workstations are named according to your naming convention during boot time.
Trackbacks
No Trackbacks
Comments