I have been testing integration with the MDT 2012 Database and ConfigMgr 2012 SP1 OSD.
So far I have had no problems configuring the database, generating the customsettings.ini, and having the Gather step process the rules and find appropriate settings based on Location when I am testing my PXE deployments. This is easy, because Locations are tied to default gateways, which are always discovered during a deployment. There is no need to tell the “Gather” step how to suck eggs (or find our location in the database!) because it has the key to form a query (the gateway)
I wanted to extend this and define some Role based settings and associate some packages to Roles.
I defined the Roles in the database, entered the desired settings, but how to have the gather step work out what Role i am deploying? I did not want to create a link to the Role based on one of the other MDT DB tables (Location, Computer, Make/Model etc). I wanted a role that could be various makes/models, locations, or computers.
Since the “Role” is stored in a task sequence variable, i first ran a test where i manually set the variables value to my desired role value using the “Set Task Sequence Variable” step. I created the variable “Role” and set it to the value that is in my database, and it worked fine. Role specific packages were installed as expected. To expand on this, I created a few different collections, each for a different deployment role, and deployed my task sequence to each one. I created a collection variable “Role” on each collection, set to a different value that corresponds to a role in my MDT DB.
What i found was that during the initial client identity request when OSD begins, the client would request collection variable policy, and no variables would be created. Other collection variables worked fine.
I then tried setting the “Role” variable on the machine itself, and the same thing happened. No machine variables were discovered during the policy request.
To work around this, I changed the name of my collection variables to something else – “BuildRole”. Then I added a “Set Task Sequence Variable” step in the task sequence, with the variable name “Role” and the value “%BuildRole%”.
Hey presto ! the ZTIGather log shows the ROLE based select statements using my variable value as the key, and the settings and packages were applied. I can only assume that the variable for Role must be somewhat reserved, although still able to be set during the task sequence step. I couldnt find this in the print ready documentation that comes with MDT 2012 Update 1.
Interestingly, during my debugging of this issue I tried Cameron K’s very handy script for echoing task sequence variables during a deployment (http://blogs.technet.com/b/cameronk/archive/2010/05/05/how-to-read-task-sequence-variables-in-a-run-state.aspx) – the custom variable “BuildRole” returned a value, but “Role” does not. Even when it is being set correctly and working fine! Another OSD Mystery..