tmiller_hockey Posted May 11, 2012 Report post Posted May 11, 2012 Anyone know of an easy way to name a computer to its serial number during OSD? I have a vbs script that I used under Altiris but how/where would I inject this script during OSD? Quote Share this post Link to post Share on other sites More sharing options...
Peter van der Woude Posted May 12, 2012 Report post Posted May 12, 2012 You can indeed just run your own custom script from a package or commandline in the task sequence, or you can use the builtin options from MDT for that. If you have MDT integrated, you can use the Gather step to get you a new variable called AsstTag. Quote Share this post Link to post Share on other sites More sharing options...
tmiller_hockey Posted May 22, 2012 Report post Posted May 22, 2012 I'm trying to figure out exactly where to inject this into the task sequence. So far no luck with where I've put it. Quote Share this post Link to post Share on other sites More sharing options...
parko89 Posted May 22, 2012 Report post Posted May 22, 2012 We set the PC name of a predefined site code with serial number. See below for the VB section of our HTA: ' Run the WMI query to find the current serial number of the machine Set WMI = GetObject("WinMgmts:") Set colSerialNumbers = WMI.InstancesOf("Win32_BaseBoard") For Each objSerialNumber In colSerialNumbers sComputerName = sComputerName & objSerialNumber.SerialNumber Next ' Pass our variables back to the Task Sequence so that they can be used. oTaskSequence ("OSDDomainOUName") = sLDAP oTaskSequence ("OSDTimeZone") = sTimeZone sComputerName = sSiteCode & "-" & sComputerName oTaskSequence ("OSDComputerName") = sComputerName ' Close the window seeing as we are finished with this HTA. window.close End If End Sub Hope this helps. You need to first get the serialnumber from a WMI query. Then you need to set the TS Variables and pass them back to the task sequence. There's a lot of examples online. Quote Share this post Link to post Share on other sites More sharing options...
tmiller_hockey Posted May 23, 2012 Report post Posted May 23, 2012 I have a VBS script already that works running on a local machine and passed via Altiris to a machine. I just need to know how to get this script to run and where to put it in the task sequence. ' vbscript ' Declare Variables Dim strLocation Dim strSerialNum Dim strAppend Dim strComputerName Dim strLclUser Dim strLclPW Dim strComputer Dim objWMIService Dim objComputer ' Set Variables strLclUser = "Administrator" strLclPW = "password" ' Obtain Serial Number strComputer = "." Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2") Set colSMBIOS = objWMIService.ExecQuery("Select * from Win32_BIOS") For Each objSMBIOS in colSMBIOS strSerialNum = objSMBIOS.SerialNumber Next ' Set Computer Name strComputerName = strSerialNum ' Rename Computer For Each objComputer in objWMIService.InstancesOf("Win32_ComputerSystem") Return = objComputer.Rename(strComputerName, strLclUser, strLclPW) If Return <> 0 Then WScript.Echo "Rename failed. Error = " & Err.Number Else WScript.Echo "Rename succeeded." & " Reboot for new name to go into effect" End If Next Quote Share this post Link to post Share on other sites More sharing options...
Peter van der Woude Posted May 23, 2012 Report post Posted May 23, 2012 Run it before the Setup Windows -step. To pass the variable on in the Task Sequence use the last part of the script of parko89. Quote Share this post Link to post Share on other sites More sharing options...
tmiller_hockey Posted May 23, 2012 Report post Posted May 23, 2012 I figured this out in a very simple way with a very short script. Insert into TS right after Partition Disk. 'vbscript set env = CreateObject("Microsoft.SMS.TSEnvironment") Set ProgressUI = CreateObject("Microsoft.SMS.TsProgressUI") 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") = objItem.SerialNumber Next Quote Share this post Link to post Share on other sites More sharing options...
magicm Posted May 23, 2012 Report post Posted May 23, 2012 you could simply set this in customsettings.ini then it will apply to all task sequnces ==> OSDComputername=%SerialNumber% Quote Share this post Link to post Share on other sites More sharing options...
tmiller_hockey Posted May 23, 2012 Report post Posted May 23, 2012 Where would I find customsettings.ini? Quote Share this post Link to post Share on other sites More sharing options...
Magill Posted July 2, 2012 Report post Posted July 2, 2012 tmiller_hockey, Sorry no one has reponded -- CustomSettings.ini requires MDT (Microsoft Deplyment toolkit) -- you can download/install it (about 22MB) then go to: http://blogs.technet.com/b/anilm/archive/2012/05/06/integrating-mdt-2012-rtm-with-configuration-manager-2012-rtm-part-2-configuring-integration.aspx This shows how to Integrate MDT with SCCM (Super Easy)!! I am personnaly VERY New to SCCM and giving the above steps a go. Quote Share this post Link to post Share on other sites More sharing options...