|
|
Blog_Archive
|
 |
|
|
|
 |
|
|
Generate Computernames in MDT 2010 based on prefix and a sequencenumber
|
 |
|
Location: Blogs Johan Arwidmark |
 |
| Posted by: johan |
1/17/2010 |
Generate Computernames in MDT 2010 based on prefix and a sequencenumber
This procedure works like this: If they computername is in the database already (known), it will assign that name to the PC. If the computer is not in the database (unknown), it will generate a computername based on the prefix and the next sequencenumber.
Step 1- Setting up the Database (detailed step-by-step guide & Video tutorial for this step is available for download on www.deploymentcd.com )
- On the MDT Server (MDT01 in my example), install SQL Server 2008 Express SP1. After installation, enable Named Pipes and restart the service
- Using the Deployment Workbench, in the advanced node, create a new Database (named MDT in my example)
- Using SQL Management Studio (Server name is MDT01\SQLEXPRESS), create a Security Login for the domain\user account that you use for your Lite Touch installations
- For the previously created Security Login, add the following permissions to the MDT Database.
- db_datareader
- db_datawriter
Step 2 - Add and configure a Stored Procedure + Table for generating computernames based on prefix + sequencenumber
- Download the files from here... http://www.deployvista.com/Repository/tabid/71/EntryId/59/DMXModule/396/Download/attachment/language/en-US/Default.aspx
- Using SQL Management Studio, open the InsertComputerNames.sql script and execute it (F5)
- For the Security Login created in Step 1, grant execute permissions to the IdentifyComputer Stored Procedure (found under Programmability / Stored Procedures)
- Open the MachineName.sql script and execute it (F5)
- Edit the MachineNameSequence table, in the prefix field, type in PC, in the sequence field type in 0 (Zero)
Step 3 - Configure the Deployment Share rules
- Use the info in the sample customsettings.ini file to configure the rules on your deployment share to use the stored procedure
/ Johan |
|
| Permalink |
Trackback |
Comments (20)
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By SX00237 on
1/25/2010 |
| Hi all, I was struggling to let it work . Because I am not a DB guru I did not implemented the last line correctly “Edit the MachineNameSequence table, in the prefix field, type in PC, in the sequence field type in 0 (Zero)”. For all the DataBaseDummy’s like I am : Databases > MDT > Tables > dbo.MachineNameSequence > RightMousButton > Edit Top 200 Rows > Prefix field, type in PC, Sequence field type in 0 (Zero) |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By Lightman81 on
2/4/2010 |
Really nice!
Is it possible to use different prefixes depending on your computer is virtuell or not. Ex VM1 for Virtual machine and PM1 for physical machine? |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By johan on
3/27/2010 |
| If you update the store procedure to take another parameter (like isdesktop), yes |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By Ltandy on
4/27/2010 |
| This worked great for me after making a few changes but now MDT 2010 is reporting "Records returned from SQL = -1" and it isn't pulling any values from the database. When I run the procedure from SQL Sever I get the correct record. What does the -1 mean? |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By c0zzman on
12/15/2010 |
Hi Johan Question.... If I use SCCM should I create a MDT db as well or use SCCMDB?
And what if I use separate names for laptops/desktops/cities? Should I type in all name I have for all my pc's?
My problem is that OSD dosen't seems to save the name I type in so my later OU-tasks dosen't work. Any solution?
//henrik |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By johan on
12/15/2010 |
Hi Henrik,
This stored procedure is for the MDT database, but that database is used with Zero Touch as well (ConfigMgr 2007).
You need to configure your setting package in ConfigMgr with the rules to read the settings and run the stored procedure... |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By AJHumphreys on
1/20/2011 |
Johan,
Do you know of anyway to do kind of the opposite? Regardless of the hardware, assign the computer a name from a list? Obviously you would remove the used name.. but I am looking for a way to tell MDT to grab a name from a list for a series of computers... and obviously they are not sequential names. |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By johan on
1/20/2011 |
Sure, just import the list into the database, or add them in manually...
/ Johan |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By AJHumphreys on
1/21/2011 |
Actually I was thinking more along the lines of a mass deployment scenario... where you have a bunch of unknown computers all the same make and model... and you have a list of names that need assigned to them that are arbitrary...
Could this procedure be altered? Or is there an easier way? |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By johan on
1/21/2011 |
Well, this stored procedure does exactly that, hands out a new unique name to any unknown computer regardless of hardware.
/ Johan |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By AJHumphreys on
1/31/2011 |
I actually have made some changes to this and it is working how I wanted.... but as always I have another idea.
Is there anyway to return a value from the stored procedure call and use that value to set a variable in the CS.ini?
I notice this sproc doesnt really return anything. |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By johan on
2/2/2011 |
The SP does return a whole recordset of values, and they will be used as variables. You can certainly add more to the recordset that is returned if needed.
/ Johan |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By runebelune on
3/15/2011 |
Hi,
I've added other functionality for location naming and OU assignment. read more on: http://runebelune.blogspot.com/2011/03/generate-computer-names-in-mdt-2010sccm.html
Rune |
|
|
how to fix this error |
By rotkej on
4/14/2011 |
| Every time I try and add a database connection, I get an error stating inaccessible server. I have tried this on various databases and mdt servers. I am using sql server 2008. |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By johan on
4/20/2011 |
You need to have named pipes enabled (its disabled by default), and you need to have permissions to create a database in SQL.
/ Johan |
|
|
is it possible to use UDI wizard and selecting more than one prefix? |
By discontinuity on
3/12/2012 |
| Hello. Amazing info, I finally managed to implement this. But we have more than twenty departments and we'd like to assign appropriate department prefix and sequence number to our computers during os deployment. Is this possible using MDT's UDI wizard? Thank you. |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By johan on
3/12/2012 |
UDI supports multiple configuration files via custom properties in cs.ini, so yes, youcan different naming conventions depending on department or other attributes that you assign. You can also extend this stored procedure to take additional arguments, like what prefix that should be used.
/ Johan |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By discontinuity on
3/12/2012 |
Amazing fast response! At least I've learned that it's technically possible to achieve what I want to do. But I've no experience in sql so extending the stored procedure on my own is not possible. Do you know any guide about this?
Using multiple config files can be a solution but I don't know how to implement this. I guess I have to create different tables with different prefixes. Create different stored procedures and use appropriate config files. But how can I create a selection page in UDI so that it uses the relevant config file during osd? Sorry for too many questions. Thank you again. |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By johan on
3/12/2012 |
I haev not written any guides on how to extend the stored procdure, it's not that complicated though... talk with your SQL dba and he/she will be able to help you...
As for using multiple configuration files with UDI: Here is a good article by Chris Nackers on the topic: http://www.chrisnackers.com/2010/07/15/mdt-configmgr-udi-having-multiple-configurations-for-the-udi-wizard-udiwizard-config-xml/
/ Johan |
|
|
Re: Generate Computernames in MDT 2010 based on prefix and a sequencenumber |
By discontinuity on
3/12/2012 |
| Thank you very much for that great article about using multiple config files. Though I still don't know how to implement what I wanna do, I have the feeling that I'm close to the end :) I guess with different stored procedures and tables I can achieve that. |
|
|
|
|
|
Search_Blog
|
 |
|
|
|
 |
|