共用方式為


Computer Name Selection in ZTI Deployments

I've been asked by a few people about the RequestComputerName.vbs script that i use in the ZTI configuration demo video posted earlier. The script prompts the technician for a computername at the start of the deployment process and stores it as an OSD variable (OSDNEWMACHINENAME) for use by the ZTI scripts.

The VB script is as follows:

Option Explicit

Dim numCount
Dim strComputerName
Dim objOSD

Do While numCount = 0
strComputerName = InputBox ("Please enter a name for the new computer:","New Computer Name","Vista00",10,10)
If strComputerName = "" Then
Wscript.Echo "You must enter a computer name."
Else
Set objOSD = CreateObject("OSD.Environment")
objOSD("OSDNEWMACHINENAME") = strComputerName
Set objOSD = Nothing
Exit Do
End If
Loop

The script is copied to your ZTI distribution point scripts folder (and then copied over to the SMS OSD deployment point) and is called by entering a new task into the task suquencer in the NEW COMPUTER folder in the PREINSTALL phase. This task, after creation should then be moved to the top of the list in the NEW COMPUTER folder

It is also possible to use the BDD 2007 wizard framework to create wizards that prompt for information at build time and use the OSD variables. BDD already supplies a COMPUTERNAME wizard and this could be used instead of the VB script shown above - Ben has an excellent piece on how to do this on his blog

Comments

  • Anonymous
    January 01, 2003
    I watched you Zero Touch Configuration video many times.  And I'm able to do everything, but this RequestComputerName.vbs.  I created the vbs file with the above code, but it always fails on me during the new computer build sequence. Am I suppose to change something in the VB code to work within my particualar environment.  FYI - I'm no VB scripter to begin with, but I know enough to get by. Thanks, David  

  • Anonymous
    January 01, 2003
    I am strggling to find a script that works to set the name in SCCM 2008 R2. I have found 2... one just fails... the other seems to run at the beginning but does not follow though. I would have though MSN would have made this a basic feature of OS Deployment like it was in the old RIS days when you could select custome and type in a name.

  • Anonymous
    January 01, 2003
    I deploy Windows Vista with SMS 2003. The created OS Image Installation CD I added to boot from RIS. In RIS I have to enter the computername to create the account in AD. To protect users to add the comptuername two times I did a little change in the script: Set reg = GetObject("winmgmts:rootdefault:StdRegProv") Dim strComputerName Dim objOSD Dim reg On Error Resume Next For each os in GetObject("winmgmts:").InstancesOf("Win32_ComputerSystem") strComputerName=os.Name Set objOSD = CreateObject("OSD.Environment") objOSD("OSDNEWMACHINENAME") = strComputerName Set objOSD = Nothing Next But without the script by Mr. Smith I didn´t know how to enter the computername. Thanks!

  • Anonymous
    March 01, 2011
    Wondering if you could post the script to colllect the Assets serial number and adds it to the isLaptop, isDesktop, isServer (L, D, S) values.  I liked the idea of using the database to also store the location based on gateway values.  This makes a nice recommendation for a computer name TLLAAAAAA (Type, Location, Asset SN).