Model - Include in computer name
Hi guys, I have inherited an SCCM environment. 1000 client machines. We have changed the computer naming convention so that it is now *****-SerialNumber Where ***** is Model of machine for example 745 (for Dell Optiplex 745), so for example we have a Dell machine named 745-D6F3N1S . The previous person before me had a script which prompted the user for a computer name. It prep populated the last part of the computer name with the serial number. What I want to happen is for the OSD task sequence automatically name the computer with this new naming convention (without prompting). Can anyone advise? I have the current script shown below. I am sure its just a matter of finding the correct variable to use... ----------------------------- <job id="ZTIPromptForComputerName"> <script language="VBScript" src="ZTIUtility.vbs"/> <script language="VBScript"> Option Explicit Dim numCount Dim strComputerName Dim objOSD dim laptop dim desktop dim oType dim mname dim SN laptop = oEnvironment.Item("IsLaptop") desktop = oEnvironment.Item("IsDesktop") SN = oEnvironment.Item("SerialNumber") if laptop = "True" Then oType = "Notebook" end if if desktop = "True" Then oType = "Desktop" end if wscript.echo SN mname = oType & "-" & SN Do While numCount = 0 wscript.echo mname strComputerName = InputBox ("Please enter a name for the new computer:","New Computer Name",mname,10,10) If strComputerName = "" Then Wscript.Echo "You must enter a computer name." Else oEnvironment.Item("OSDNEWMACHINENAME") = strComputerName oEnvironment.Item("OSDCOMPUTERNAME") = strComputerName Exit Do End If Loop </script> </job> ------------------------------------------- Thanks Nick
July 4th, 2011 6:31am

Hello - Not sure, this will really help you or not....Have you seen this ? http://www.windows-noob.com/forums/index.php?/topic/1133-setting-computername-during-deployment/#entry5374Anoop C Nair - This posting is provided "AS IS" with no warranties or guarantees, and confers no rights. |Please remember to click Mark as Answer on the post that helps you, and to click Unmark as Answer if a marked post does not actually answer your question. This can be beneficial to other community members reading the thread.
Free Windows Admin Tool Kit Click here and download it now
July 4th, 2011 8:20am

HI, You could try this out, it will take the last 4 characters in the modelname and add as you described above. Just run it as a normal program in the begining of the task sequence, no requirement to use MDT. i Hope it helps you out. Option Explicit Dim oEnv Dim strComputerName Dim obJWMIService Dim colBIOS Dim objBIOS Dim objOSD Dim strSN, strModel Dim colSettings Dim objComputer Dim strModelshort Set oenv = CreateObject("Microsoft.SMS.TSEnvironment") Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2") Set colBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS") For each objBIOS in colBIOS StrSN = objBIOS.SerialNumber Next Set colSettings = objWMIService.ExecQuery("Select * from Win32_ComputerSystem") For Each objComputer in colSettings strModel = objComputer.Model Next strModelshort = Right(strModel,4) strComputername = trim(strModelshort) & "-" & strSN oEnv("OSDNEWMACHINENAME") = strComputerName oEnv("OSDCOMPUTERNAME") = strComputerName Regards, Jörgen-- My System Center blog ccmexec.com --
July 4th, 2011 11:44pm

Ok, thanks guys. I got it sussed. Because the model variable always contains a space i.e Latitude D530, Optiplex 790 etc.. I used a variable split as per below. Works a treat. Will build machine with computer name taken from the BIOS (dont have to prompt for computer name each time) ----------- <job id="ZTIPromptForComputerName"> <script language="VBScript" src="ZTIUtility.vbs"/> <script language="VBScript"> Option Explicit Dim numCount Dim strComputerName Dim objOSD dim laptop dim desktop dim oType dim mname dim SN dim model dim modelnum laptop = oEnvironment.Item("IsLaptop") desktop = oEnvironment.Item("IsDesktop") SN = oEnvironment.Item("SerialNumber") model = oEnvironment.Item("Model") if laptop = "True" Then oType = "Notebook" end if if desktop = "True" Then oType = "Desktop" end if wscript.echo SN modelnum = split(model) mname = modelnum(1) & "-" & SN oEnvironment.Item("OSDNEWMACHINENAME") = mname oEnvironment.Item("OSDCOMPUTERNAME") = mname </script> </job> ----------------------------
Free Windows Admin Tool Kit Click here and download it now
July 5th, 2011 12:37am

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics