You are here:   Research
  |  Login

Welcome to my blog, quickest way to find articles is usually to search for them.

Search in All Title Contents

Configuring MDT Monitoring - Behind the scenes

Jan 05 2014

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:\Temp\WCF.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.


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.

$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.

The MDT_Monitor.sdf database.

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

Troubleshooting MDT 2012 Monitoring

By Maik Koster (@maik_koster)

MDT Monitoring – Deep Dive I

MDT Monitoring – Deep Dive II – Consuming the data yourself

MDT Monitoring Deep Dive III – Returning settings to a Computer

MDT Monitoring Deep Dive IV – Sending more information

By Mikael Nystrom (@mikael_nystrom)

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

Nice to Know: Connecting Excel 2013 with MDT 2012 Update 1 using OData to get monitor data


/ Johan

Happy deployment, and thanks for reading!

What our lawyers makes us say:

This information is provided "AS IS" with no warranties, confers no rights and is not supported by the authors or Deployment Artist.

Copyright © 2017 by Deployment Artist (the company behind deployment research). All rights reserved. No part of the information on this web site may be reproduced or posted in any form or by any means without the prior written permission of the publisher.

Shorthand: Don't pass off our work as yours, it's not nice.

Blog Archive