Yet another great post from DeploymentGuys !!!
For a while I have been meaning to write up a solution around dynamic computer naming in Zero Touch. Many people have emailed or commenting on how useful this would be – so here goes.
Zero Touch Installation relies on a combination of System Centre Configuration Manager (ConfigMgr) and Microsoft Deployment Toolkit (MDT) 2010/2012. The MDT guys wrote a great integration tool that gives the ability to add extra functionality to ConfigMgr such as new tasks, task sequence templates and a new wizard for creating boot disks.
The integration also allows for the MDT environment to be accessed from within the ConfigMgr task sequence through the use of MDT packages that are created by an MDT task sequence wizard installed in the ConfigMgr console. This also gives the opportunity to also access the MDT Deployment Database from within the ConfigMgr environment to set deployment variables (as opposed to setting them as collection variables).
The dynamic computer naming process I will describe below uses these integration points and the ability to run UserExit scripts. The USerExit script that is part of this post is what dynamically builds the computer name by allowing you to run an external script and return the output of the script to the task sequence process as a variable. The computer name generated by the UserExit script will be based on a location ID (two characters added as a custom property in MDT Deployment Database), the computer chassis typed (L for laptop, W for Workstation, V for Virtual and X if the chassis can not be identified), and the first 7 characters of the computer serial number (removing spaces and replacing them with minus (-) for situations where the serial number contains spaces such as virtual machines serial numbers). These three properties are then glued together and provided as the OSDComputername variable for use in the deployment process so you end up with a computer name such as: UK (location ID) L (Chassis ID) 1234567 (Serial Number ID).
For the dynamic computer naming to work, we need carry out the following task
- Create a new property in the MDT Deployment Database (for the two character location ID)
- Configure the CustomSettings.ini file (in the MDT settings package) to query the MDT Deployment Database and run the UserExit script
- Create the UserExit script that does the generation of the computer name and add it to the MDT Toolkit package
The instructions below assume that you have:
- Installed MDT 2010/2012 (probably on your central site server) and setup an MDT database.
- Run the MDT Integration (accessed through the MDT start menu folder and running Install ConfigMgr Integration)
- Created a task sequence in ConfigMgr using the MDT integration and utilising the MDT supplied client task sequence template – if you walked through the MDT task sequence wizard you should have also created the MDT support packages (MDT Boot Image, MDT Settings, MDT Toolkit and MDT USMT packages).
Step 1 – Create a new custom property in the MDT Deployment Database (for the two character location ID)
The MDT Deployment Database provided with MDT 2010/2012 on the surface looks very simple – but is actually very powerful. In this database we can store all of the variables that we used in the MDT Lite Touch world as well as extra OSD based variables for use in Zero Touch and server build task sequences. The MDT Deployment Database contains four main areas for storing variables – Computers, Location, Roles and Make/Model. In the underlying structure of the database a separate table stores the settings that are then made visible through the DETAILS tab in each of these areas………