Injecting Serial Number into the MDT database

Last summer I posted an article on how to generate computer names based on a prefix + sequence number. Since then I have received a few requests to modify it to also inject the serial number, and finally decided to post a quick how to.

The original post is here: Generate computer names in MDT 2012/2013 based on prefix and a sequence number 

Step-by-Step Guide

Here is how to modify the stored procedure to also inject the serial number:

First, the original stored procedure only took one parameter, @MacAddress, so you need to change it to also take @SerialNumber. Meaning changing:

@MacAddress CHAR(17)

to

@MacAddress CHAR(17),
@SerialNumber CHAR(255)

Second, you need to store the serial number when the computer name is generated. Meaning changing:

INSERT INTO ComputerIdentity (MacAddress, Description)
VALUES (@MacAddress, 'New York Site – ' + @NewName)

to

INSERT INTO ComputerIdentity (MacAddress, SerialNumber, Description)
VALUES (@MacAddress, @SerialNumber,'New York Site – ' + @NewName)

Here is how it looks in SQL Management Studio:

image

That's it, the stored procedure changes are done, and you only need to modify your CustomSettings.ini to send the SerialNumber Parameter. Like this:

[Settings] 
Priority=IdentifyComputer, CSettings, Default

[Default] 
OSInstall=YES

[CSettings] 
SQLServer=CM01 
Database=MDT 
Netlib=DBNMPNTW 
SQLShare=Logs$ 
Table=ComputerSettings 
Parameters=UUID, AssetTag, SerialNumber, MacAddress 
ParameterCondition=OR

[IdentifyComputer] 
SQLServer=CM01 
Database=MDT 
Netlib=DBNMPNTW 
SQLShare=Logs$ 
StoredProcedure=InsertComputerName 
Parameters=MacAddress, SerialNumber

The injected machines listed in deployment workbench. ID 11 added after the stored procedure was modified.

image

/ Johan

About the author

Johan Arwidmark

0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

>