I use this script to set the computer name on virtual computers during task sequence.
The computer naming script in the task sequence is using the serial number which for virtual computers is too long and will cause the task sequence to fail. Therefore its needed to somehow change the computer name. I have placed this script on a network share which i map after the computer have been given the long and faulty serial-number name. The script will prompt for a new computer name which will then overwrite the OSDComputerName task sequence variable.
Set env = CreateObject("Microsoft.SMS.TSEnvironment") Set SWBemlocator = CreateObject("WbemScripting.SWbemLocator") Set objWMIService = SWBemlocator.ConnectServer(strComputer,"root\CIMV2",UserName,Password) Set colItems = objWMIService.ExecQuery("Select * from Win32_BIOS",,48) For Each objItem in colItems env("OSDComputerName") = InputBox("Please enter a Computer Name:", "Computer Name") Next
Recent Comments