I found this on TechNet and had to work through it to make it work. I’ve added pics and better explanations on how to add and deploy the script to work for you. I found the scripts at this URL in TechNet. http://social.technet.microsoft.com/forums/en-US/configmgrosd/thread/5924e840-eb6e-48c1-858f-766a5be625a6/
This script will detect if the current assigned value for the computer name begins with MININT, indicating that this image is bare metal image. It then prompts the end-user to enter a new computer name. It is primarily useful for task sequences that do both bare metal and in-place reimages.
Steps to implement the script.
- Create a folder for your VBS script called “AskComputerName”.
- Copy cscript.exe to the AskComputerName folder.
3. In the folder copy the VBS script to Notepad and save the file as “askcomputername.vbs”
|Dim sNewComputerName, oTaskSequence, sTSMachineName |
Set oTaskSequence = CreateObject ("Microsoft.SMS.TSEnvironment")
' Get the name the computer is set to receive and truncate to first 6 letters
sTSMachineName = oTAskSequence("_SMSTSMachineName")
sTSMachineName = lcase(left(sTSMachineName,6))
If sTSMachineName = "minint" Then
' The wscript.echo commands are logged in SMSTS.log for troubleshooting.
' They are not displayed to the end user.
wscript.echo "Detected that the computer name is scheduled to receive a random value. Prompting user to input a standard name."
sNewComputerName = InputBox ("Please enter a standard computer name.", "Computer Name", , 30,30)
oTaskSequence("OSDComputerName") = sNewComputerName
wscript.echo "Set Task Sequence variable OSDComputerName to: " & sNewComputerName
wscript.echo "Computer set to receive a standard name, continuing as is."
4. Create an SCCM package that holds this script. Do not create a program. Leave the program blank. Add the package to the appropriate DPs
5. Edit an existing task sequence or create a new task sequence and add a new task to Run Command Line. Move it to occur between "Restart in Windows PE" and "Partition Disk"
6. For the task, give it the name you want. (e.g. AskComputerName)
7. Select checkbox "Package" and then select the package created that has the script
8. In the command line section, put the name of vbscript...with the file extension!
9. Click OK
10. When deploying an image, you will see the following box asking for the computer name.