Jump to content


  • 0
rsadmin86

MDT Computer Naming

Question

I have a SCCM 2012 R2 SP1 environment running MDT 2013. I have created a MDT Task sequence and configured it with he UDI interface. I have everything setup except for the automatic computer naming. When I created a non-MDT task sequence I used this script:

 

#get serial number

$SerialNumber = (Get-WmiObject -Class Win32_BIOS | Select-Object SerialNumber).SerialNumber

#get count of characters in serial

$count = $SerialNumber.length

#find number of characters that need to be removed

$Trim = ($count -6)

#remove characters to get last 6 characters in serial

$last6 = $serialnumber.substring($Trim)

#combine "lt" and last 6 characters of serial

$Computername = "lt" + $last6

$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment

$TSEnv.Value("OSDComputerName") = "$ComputerName"

 

 

But now that I have an MDT Task sequence and since I am using the UDI wizard to configure the interface, I am not sure where to put this the script. My goal is to have the MDT task sequence determine the hardware (Laptop or Desktop) add a prefix (DT, or LT). I thought I could do this through a script where I added a custom Task sequence variable called OSDComputerNamePrefix. When I run the Task sequence it Prompts for a Prefix, and the user will enter it in manually i.e. "LT", then I was hoping to be able to run this script:

 

$SERIAL = (Get-WmiObject win32_bios).serialnumber

 

New-Object string (,@($serial.ToCharArray() | Select-Object -Last 6))

$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment

$TSEnv.Value("OSDComputerNamePrefix") = "$Prefix"

#combine "Prefix" and last 6 characters of serial

$Computername = $Prefix + $SERIAL

$TSEnv = New-Object -COMObject Microsoft.SMS.TSEnvironment

$TSEnv.Value("OSDComputerName") = "$ComputerName"

I was hoping this would name the computer, however the task sequence fails with a 0x8000405 error. I have the script running right after the Format and Partition Disk in my task sequence. I attached a picture of my task sequence. I think I am getting confused on which components to change because there are so many (UDI wizard, MDT Task Sequence, CustomSettings.ini).I tried to use the same customSettings.ini file that was used here: http://www.ronnipedersen.com/2014/10/setting-osdcomputername-using-customsettings-ini/ and http://c-nergy.be/blog/?p=3933 and http://deploymentbunny.com/2012/04/21/back-to-basic-customsettings-ini-explained/

but when my UDI starts all I get is LT%ComputerSerialNumber% or LT#Left("SerialNumber%",6)#.

Not sure why that is failing to gather the last 6 of the serial number. The naming conventions should be Prefix (LT, or DT) with the last sixof the computer serial number. Example LT1231dh.

Thank you for your help.

 

 

 

 

 

 

post-32414-0-24768100-1449071433.png

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...


×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.