If you are following the twitter feeds from the various OSD gurus out there you might stumbled across Mikael Nystrom’s great post about creating a webpage containing the MDT monitoring data. This a perfectly good example of how you can extend the MDT Monitoring, but that of course requires that you actually have it enabled (and configured).
Enabling MDT Monitoring
Enabling monitoring in MDT is easy, simply access the deployment share properties, select the Monitoring tab, and enable monitoring.

Configuring MDT Monitoring
When enabling the monitoring feature in MDT, a SQL Compact Edition (CE) 3.5 database is created, together with a service that runs in the background. Now, when deploying machines, the progress is logged into the SQL CE 3.5 database and to the event log on the server. Even though a SQL CE 3.5 database only can store 4 GB of data you don’t need to worry. The MDT Monitoring info is quite small, and the database is purged every three days (by default).
Setting logging level and WCF.log location
In addition, if you have a C:Temp folder present on the server. the monitoring service will also log info to C:TempWCF.log (but only if you create the C:Temp folder). The information logged to WCF.log may very fill up disk space on your server so I recommend changing the amount that gets logged, and where the log file is created.
See the following post on: how to change the logging level and WCF.log location.
Setting database purge options.
You may also want to configure other default settings like how many days the monitoring data is stored. This is also done by modifying the Microsoft.BDD.MonitorService.exe.config file.
<setting name="MaxDays" serializeas="String">
<value>3</value>
</setting>
Getting data using PowerShell
If you want to read data from the MDT monitoring database there are ready-made VBScript functions (in ZTIUtility.vbs) and PowerShell cmdlets. Here is an example on how get deployment from the last three days (default value).
Add-PSSnapIn Microsoft.BDD.PSSnapIn
New-PSDrive -Name "DS001" -PSProvider MDTProvider -Root "D:\MDTProduction"
Get-MDTMonitorData -Path "DS001:"
Reading data from the MDT monitoring database.
Counting deployments
If you want to count the deployments for the last three days you can simply use the count function:
(Get-MDTMonitorData -Path DS001:).Count
Deployments from the last three days, 625 is not that bad 🙂
Write (Set) data using PowerShell
You would probably attempted to use the Set-MDTMonitorData cmdlet, please don’t, it’s broken and used for test only. If you really would like to inject data, call the web service directly. A simple HTTP Post will do just fine.
$MDTServer='MDT01:9800'
$MessageID = '41015' # Successful deployment
$MacAddress = '00:15:5D:40:00:02'
$guid = [guid]::NewGuid()
$vmhost = 'hv01'
$ComputerName = 'PC01229'
Invoke-WebRequest "http://$MDTServer/MDTMonitorEvent/PostEvent?uniqueID=&computerName=$ComputerName&messageID=$messageID&severity=1&stepName=¤tStep=10&totalSteps=10&id=$guid,$macaddress&message=Deployment Completed.&dartIP=&dartPort=&dartTicket=&vmHost=$vmhost&vmName=$ComputerName"
Taking a closer look
If you really want to see more info about the monitoring database you can easily open it in Visual Studio 2010 (SQL CE 3.5 connections was dropped from Visual Studio 2012, so you have use Visual Studio 2010, or 2008). You can open the MDT_Monitoring.sdf (make a copy) database via Server Explorer in Visual Studio 2010.
Additional reading
If you want additional gory details about how MDT monitoring really works, and some tips and tricks, I recommend the following posts:
By Michael Niehaus (@michael_niehaus)
MDT 2012 New Feature: Monitoring
http://blogs.technet.com/b/mniehaus/archive/2012/03/09/mdt-2012-new-feature-monitoring.aspx
Troubleshooting MDT 2012 Monitoring
http://blogs.technet.com/b/mniehaus/archive/2012/05/10/troubleshooting-mdt-2012-monitoring.aspx
By Maik Koster (@maik_koster)
MDT Monitoring – Deep Dive I
http://myitforum.com/cs2/blogs/maikkoster/archive/2012/07/16/mdt-monitoring-deep-dive-i.aspx
MDT Monitoring – Deep Dive II – Consuming the data yourself
http://myitforum.com/cs2/blogs/maikkoster/archive/2012/07/25/mdt-monitoring-deep-dive-ii-consuming-the-data-yourself.aspx
MDT Monitoring Deep Dive III – Returning settings to a Computer
http://myitforum.com/cs2/blogs/maikkoster/archive/2012/08/21/mdt-monitoring-deep-dive-iii-returning-settings-to-a-computer.aspx
MDT Monitoring Deep Dive IV – Sending more information
http://myitforum.com/cs2/blogs/maikkoster/archive/2012/08/21/mdt-monitoring-deep-dive-iv-sending-more-information.aspx
By Mikael Nystrom (@mikael_nystrom)
PowerShell is King – I need to monitor OS Deployment in MDT 2012 not using Deployment Workbench
http://deploymentbunny.com/2013/03/06/powershell-is-king-i-need-to-monitor-os-deployment-in-mdt-2012-not-using-deployment-workbench/
PowerShell is King – Create a webpage containing LTI/ZTI Deployment issues with information and links to logs
http://deploymentbunny.com/2013/12/29/powershell-is-king-create-a-webpage-containing-ltizti-deployment-issues-with-information-and-links-to-logs/
Nice to Know: Connecting Excel 2013 with MDT 2012 Update 1 using OData to get monitor data
http://deploymentbunny.com/2012/08/29/nice-to-know-connecting-excel-2013-with-mdt-2012-update-1-using-odata-to-get-monitor-data
/ Johan