Solved

ComputerName Script during OSD in SCCMwith MDT

Posted on 2014-10-28
3
307 Views
Last Modified: 2016-11-23
I have been using the following Script during my OS deployment... IT works perfectly and meets my needs 90% of the time.
BAsically, it will prompy for a location code and attached a "-" and the "Dell Service tag"  Example abc-1234567

What I want to add is when I am using the same PXe boot to a VM, (VMWARE Virtual Desktops), The serialnumber I believe is the mac address and longer than the 15 char limit so my OSD fails during the task sequence.

Does any one has a simple suggestion or fix for this issue?

***************************************************************
Dim strComputer, objWMIService, colBIOS, objBIOS, strServiceTag
strComputer="."
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colBIOS = objWMIService.ExecQuery("Select SerialNumber from Win32_Bios")
For Each objBIOS In colBIOS
strServiceTag = objBIOS.SerialNumber
Next

Dim sNewComputerName, oTaskSequence, sTSMachineName, bPromptName
Set oTaskSequence = CreateObject ("Microsoft.SMS.TSEnvironment")
 
' Get the name the computer is set to receive and truncate to first 6 letters
sTSMachineName = lcase(oTaskSequence("_SMSTSMachineName"))
If left(sTSMachineName,6) = "minint" Then
   bPromptName = True
ElseIf sTSMachineName = "minwinpc" Then
   bPromptName = True
Else
   bPromptName = False
End If
 
' Note: The wscript.echo commands are logged in SMSTS.log for troubleshooting.  They are not displayed to the end user.
If bPromptName = True Then
   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 your Location Code to continue." & vbCrLf & _
   "The name will be set to XXX-" & strServiceTag & vbCrLf & _
   "where XXX is the location you enter.", "Computer Location", , 30,30)
   oTaskSequence("OSDComputerName") = UCase(sNewComputerName & "-" & strServiceTag)
   wscript.echo "Set Task Sequence variable OSDComputerName to: " & sNewComputerName & "-" & strServiceTag
Else
   wscript.echo "Computer set to receive a standard name, continuing as is."
End If
*************************************************************************
0
Comment
Question by:petrosyg
  • 2
3 Comments
 
LVL 78

Accepted Solution

by:
David Johnson, CD, MVP earned 500 total points
ID: 40410106
oTaskSequence("OSDComputerName") = left(UCase(sNewComputerName & "-" & strServiceTag),15)
0
 

Author Comment

by:petrosyg
ID: 40410458
David, Thank you for your response. I do not recall if the syntax was correct I recall doing something with the same logic- most likely wrong syntax and during the TS step I saw the step getting executed but never got my prompt. So I will try yours and let you know.

Thank you kindly,
Petros
0
 

Author Closing Comment

by:petrosyg
ID: 40416265
David, Great tip and thank you for all your help --- it worked !!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Today, still in the boom of Apple, PC's and products, nearly 50% of the computer users use Windows as graphical operating systems. If you are among those users who love windows, but are grappling to keep the system's hard drive optimized, then you s…
Possible fixes for Windows 7 and Windows Server 2008 updating problem. Solutions mentioned are from Microsoft themselves. I started a case with them from our Microsoft Silver Partner option to open a case and get direct support from Microsoft. If s…
This Micro Tutorial will give you a basic overview of Windows Live Photo Gallery and show you various editing filters and touches to photos you can apply. This will be demonstrated using Windows Live Photo Gallery on Windows 7 operating system.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now