MDT Monitoring Deep Dive III – Returning settings to a Computer
If you enable the MDT Monitoring, you also enable kind of a “hidden” feature, that will give you just another way of setting properties on computers that are being deployed.
One of the most important tasks in MDT is the gather process. It collects information locally on the client computer like hardware info etc. It evaluates the rules configured in the customsettings.ini and can also query databases and web services or run additional scripts for this evaluation. Now, since MDT 2012, if you enabled the monitoring, it will also query the MDT Monitoring web service, if it has some additional settings for the client.
It calls a function called “GetSettings” on the same web service path as it sends the monitoring data to. As a side note, if you create your own web service, as demoed in the previous post, make sure you also implement this function, otherwise you will see some errors in the Gather log. For the demo monitoring web service, we will fix this in the next post.
Let’s have a quick look in the logs from a very simple gather with debugging enabled (otherwise those web service calls will be “silent”)
As we can see, it’s calling the “PostEvent” function first to get the unique ID for this deployment. This normally happens before the gather steps runs the first time and is just due to the fact that I started only gather. Then it’s calling the “GetSettings” function with this unique ID, but we don’t get any information back as we haven’t stored any yet.
One important thing to note here is, that the web service call happens after(!) the gather process has finished processing the customsettings.ini file. This is important to know due to the “First value wins” behavior of most MDT properties.
Now, how can we store a setting, so that it can be retrieved from the computer?
Well, there is a PowerShell cmdlet called “Set-MDTMonitorData”, that we can use for this. And this cmdlet has a parameter called “Setting” that takes a hashtable. Please see the first post of this series for some general information on how to use PowerShell cmdlets to handle monitoring data.
Now for demonstration purposes, I want to set the OSDComputerName to “HelloWorld” and the SkipWizard to “YES”. For this I use the following PowerShell command:
1 |
Set-MDTMonitorData -path MDT: -MacAddress "00:11:22:33:44:55" -Setting @{"OSDComputerName"="HelloWorld";"SkipWizard"="YES"} |
where MacAddress is the MacAddress of the Client computer. Now, if we run gather again, we will see, it is now obtaining those values from the web service, giving us just another way to influence our deployments.
In the next post, we will implement this function in our custom web service.
1 Response
[…] In my post MDT Monitoring Deep Dive II – Consuming the data yourself, I showed you how you can write your own web service, that consumes the MDT monitoring information. The next thing we will cover is, how we can send even more information from MDT and also make use of a pretty hidden feature in this monitoring option I blogged about in the last post. […]