Determining a computer name during an imaging process has always proved to be a challenge. One of my favorite methods is to utilize WMI to obtain the serial number of the computer that is being imaged. This way, if all your hardware is from a particular vendor, Dell, HP, Panasonic, you can guarantee that no two computer names will ever be the same and you can name them automatically during the imaging process. Not to mention you can quickly look up the computer information on the vendor website.
The following vbscript I wrote will determine the serial number, append a “C” to the front of it, then populate the OSD task sequence variable called “OSDComputerName”. It is one of the first tasks in all my task sequences. One of the extras I wrote in will actually prompt you to enter the computer name if it detects it is a VMware, Citrix or Microsoft Virtual machine, because they do not have a serial number in WMI. Enjoy!
Just rename to .vbs