How to assign a dynamic computername during OSD
Posted by: hho in script, OSD, HP, Dynamic computername, Dynamic, Dell, Computername on
Apr 20, 2011
With ConfigMgr 2007 there can be put many information in the Task Sequence used for OSD. With Windows XP, Vista or 7 there will be different files created for using a unattend installation. All information set in the Task Sequence will be used for creating that specific file. Only a dynamically computername is missing here! How to assign a dynamic computername during OSD, that's the question!
In a Task Sequence used for OSD, this information can be placed in "Apply Windows Settings" and "Apply Network Settings". In "Apply Windows Settings" the following information is (most of times) set:
- User/Organization name
- Product key
- Local administrator password
- Time zone
In "Apply Network Settings" the following information is (most of times) set:
- Join a workgroup or domain
- Set specific domain information
- Account used for domain join
With this information a sysprep.inf file (for Windows XP) or a unattend.xml file (for Windows Vista or 7) is created at specific places. The sysprep.inf file will be created/placed at C:\Sysprep (with the deployment tools). The unattend.xml will be created/placed at C:\Windows\Panther\Unattend. Sysprep is already build-in for Windows Vista and 7.
During above steps ("Apply Windows Settings" and "Apply Network Settings") these files will be generated. During "Setup windows and ConfigMgr" these files will be used for having a unattend installation. The only information missing here is how to set the computername?
With MDT integration an additional step is used for making that possible. Then a Task Sequence variable can be used for dynamically assigning a computername. This is explained here: http://blog.coretech.dk/mip/wrong-pc-name-after-deployment/
With ConfigMgr only (without MDT integration) an additional script is needed for unattended installation, or the computername must be filled-in manually during OSD (not recommended). The additional script must have lines in it for recognizing the computername in the BIOS, and place that information in the sysprep.inf or unattend.xml file.
Most of times I disable both "Apply Windows Settings" and "Apply Network Settings" steps in the Task Sequence, and making use of the sysprep.inf and/or unattend.xml which is created by ConfigMgr during OSD. The only change I make then is to replace the Computername with an "*" sign, and create a separate package from this file.
Then I put that file (as package) at the "Apply Operating System" step. The package which contains the script (converted to executable) is put in an additional step, in this case: "Assettag To Unattend". The script I use is as follows (using the Asset Tag as computername):
Windows XP on HP devices:
Visit Henk's blog:
http://henkhoogendoorn.blogspot.com/2011/03/how-to-assign-dynamic-computername.html
Windows XP on Dell devices:
Replace "systemenclosure get smbiosassettag" with "systemenclosure get serialnumber". Then it works also on Dell devices.
Windows Vista or 7 on HP devices:
Visit Henk's blog:
http://henkhoogendoorn.blogspot.com/2011/03/how-to-assign-dynamic-computername.html
Windows Vista or 7 on Dell devices:
Replace "systemenclosure get smbiosassettag" with "systemenclosure get serialnumber". Then it works also on Dell devices.
(thanks to Wilfred Hanekamp for sharing the script)
Download and install AutoIt for making changes to this script, and building a executable file from it. With this script, assigning a dynamic computername is possible, without using MDT integration!
ConfigMgr rocks again!
Update 15-11-2011: Because of some comments that the script isn't working I replaced the script with additional values. This time the script must be functional again.
