Windows – Custom MDT Property/Variable Not Getting Evaluated During Task Sequence

mdtwdswindows

Good-day all,

I need some help with a Microsoft Deployment Toolkit (MDT) project I’m working on. So, I'm attempting to set the ComputerName on newly imaged machines using a concatenation of the custom variable/property (ComputerType) and a string manipulation of the built-in SerialNumber variable. Unfortunately, this is failing for me as my custom variable isn't being expanded/evaluated during the task sequence. Instead of seeing the value, I'm seeing the name of the variable itself displayed as "%ComputerType%". The same is true when looking at the BDD.log file.

Below is what I have in my CustomSettings.ini file (set via the Rules section of the MDT Workbench). This behavior is confirmed when I look at the Monitoring section of the MDT Workbench, where I see "Prefix-%ComputerType%-000b5" listed as the "Name" of the computer being imaged, instead of something like "Prefix-VM-000b5". This ends up creating a computer name that exceeds the 15-character limitation of Windows, as such, my task sequence fails when it goes to change the computer name during the post install phase.

What am I doing wrong?

Here's what my CustomSettings.ini file looks like:

[Settings]
Priority=IsVM,IsLaptop,IsDesktop,IsServer,SetComputerName,Default
Properties=ComputerType,MyCustomProperty

[IsVM]
Subsection=Virtual-%IsVM%

[IsLaptop]
Subsection=Laptop-%IsLaptop%

[IsDesktop]
Subsection=Desktop-%IsDesktop%

[IsServer]
Subsection=Server-%IsServer%

[Virtual-True]
ComputerType=

[Laptop-True]
ComputerType=LT

[Desktop-True]
ComputerType=WS

[Server-True]
ComputerType=SV

[SetComputerName]
OSDComputerName=Prefix-%ComputerType%-#Right(Replace(Replace(oEnvironment.Item("SerialNumber")," ",""),"-",""),5)#

[Default]
_SMSTSORGNAME=OS Deployment on %OSDComputerName%
FullName=Assigned User's Name
OrgName=My Company Name
Home_Page=https://mail.exchangeserver.com
User_Locale=en-us
KeyboardLocale=en-us
UserDataLocation=NONE
DoCapture=YES
OSInstall=Y
AdminPassword=MyPassword
TimeZone=035
TimeZoneName=Eastern Standard Time
JoinWorkgroup=WORKGROUP
HideShell=YES
FinishAction=SHUTDOWN
DoNotCreateExtraPartition=YES
AppyGPOPack=NO
SkipAdminPassword=YES
SkipProductKey=YES
SkipComputerName=YES
SkipDomainMembership=YES
SkipUserData=YES
SkipLocaleSelection=YES
SkipTaskSequence=NO
SkipTimeZone=YES
SkipApplications=YES
SkipBitLocker=YES
SkipSummary=YES
SkipRoles=YES
SkipCapture=NO
SkipFinalSummary=NO
SkipComputerBackup=YES
EventService=http://mdtserver

;LOGGING
SLShare=\\mdtserver\DeploymentShare$\Logs
SLShareDynamicLogging=\\mdtserver\DeploymentShare$\Logs\%ComputerName%

Best Answer

EUREKA! PROBLEM SOLVED!!!

Turns out that the name of my Section headers cannot be the same as that of the built-in MDT variables. Here’s what I mean:

[Settings]
Priority=IsVM,IsLaptop,IsDesktop,IsServer,SetComputerName,Default
Properties=ComputerType,MyCustomProperty

Notice above that in my [Settings] section, the Priority header is set to “IsVM, IsLaptop….etc”,

[IsVM]
Subsection=Virtual-%IsVM%

[IsLaptop]
Subsection=Laptop-%IsLaptop%

Notice also that my custom sections bear the same name as the built-in MD variables I’m testing (i.e., IsVM)

By changing the custom section names as follows and rebuilding my MDT DeploymentShare, everything is working now.

[Settings]
Priority=ByVM,ByLaptop,ByDesktop,ByServer,SetComputerName,Default
Properties=ComputerType,MyCustomProperty

[ByVM]
Subsection=Virtual-%IsVM%

[ByLaptop]
Subsection=Laptop-%IsLaptop%

With this working now, I can use a single deployment share to dish out specific task sequences (i.e., OS Images) to specific machines based on their detected hardware type. Hope this helps someone out.

Related Topic