Deployment

Nice to Know – Dumping MDT Monitor data to a Webpage (using PowerShell) – Update

A couple of days ago I published a simple PowerShell script that dumps the MDT monitoring data and convert it into a web page, the interest for that has been huge. The customer came back to me with one of those –Is it possible to…

They wanted to have the role that is assigned to the computer and that information is not in the MDT monitoring data output, but it is in the MDT database, so if I could read that using PowerShell and use the name from the MDT Monitoring as input, that should be doable. So I “sacrificed” the evening and now it is working, email the customer and the response was “Thank you!!”, so I thought maybe you would like to get the update to.

The new look! (including the Role information from the MDT database)

image

The new Script

image

The difference is:

Line 2 and 3:
  • I added the logic to connect to the DB
Line 11 – 15
  • I added logic to get the role from the DB
Line 42
  • I added Role in the select state
Line 49
  • I added Role in the select state

That’s all

/mike

(link is updated)

Download the script: Files/Tools/GenOSDStatusV2 at master · DeploymentBunny/Files (github.com)

Read about the original post here: https://deploymentbunny.com/2013/12/09/nice-to-know-dumping-mdt-monitor-data-to-a-webpage-using-powershell/

Read about Sean O’Mahony’s ”branding/styling” here : http://mentalseepage.wordpress.com/2013/12/12/output-mdt-monitor-tab-to-webpage/

Read about getting the MDT Monitor to work in SCCM here: http://www.deploymentresearch.com/Research/tabid/62/EntryId/131/Adding-DaRT-8-1-from-MDOP-2013-R2-to-ConfigMgr-2012-R2.aspx

Read about the PowerShell module for MDT here: http://blogs.technet.com/b/mniehaus/archive/2009/07/09/3241504.aspx

Categories: Deployment, MDT, PowerShell, SCCM

Tagged as: , ,

25 replies »

  1. Tja Micke!
    Nice! Ett sätt att få lite trevligare layout är att importera ett style-sheet:
    istället för att skriva i koden:
    <#$s = "”
    $s = $s + “BODY{background-color:peachpuff;font-family:Verdana;}”
    $s = $s + “TABLE{border-width: 1px;border-style: solid;border-color: black;border-collapse: collapse;}”
    $s = $s + “TH{border-width: 1px;padding: 4px;border-style: solid;border-color: black;background-color:thistle;text-align:left;}”
    $s = $s + “TD{border-width: 1px;padding: 4px;border-style: solid;border-color: black;background-color:palegoldenrod;}”
    $s = $s + “”
    #>
    #Import StyleSheet
    $s = Get-Content $ScriptLocation\Style.txt
    #$s

    Där tex style.txt kan se ut så här:

    body {background-color:Gainsboro ;font-family:Verdana; 12px;font-weight: normal;}
    body a{background-color:Gainsboro ;font-family:Verdana; 12px;font-weight: normal; color:MidnightBlue;}
    h5 {background-color:Gainsboro ;font-family:Verdana; 6px;font-weight: normal; color:DarkGray ;}
    table {border-collapse: collapse; text-align: left; width: 100%; }
    table td {font: normal 12px/150% Verdana, Arial, Helvetica, sans-serif; background: #fff; overflow: hidden; border: 1px solid #36752D; }
    table th {font: bold 14px/150% Verdana, Arial, Helvetica, sans-serif; background: LightSteelBlue ; text-align:left;border: 1px solid #36752D; }
    /*thead th {background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #36752D), color-stop(1, #275420) );background:-moz-linear-gradient( center top, #36752D 5%, #275420 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=’#36752D’, endColorstr=’#275420′);background-color:#36752D; color:#FFFFFF; font-size: 15px; font-weight: bold; border-left: 1px solid #36752D; }*/
    thead th:first-child { border: none; }
    table tbody td { color: #275420; border-left: 1px solid #C6FFC2;font-size: 12px;font-weight: normal; }
    table tbody .alt td { background: #DFFFDE; color: #275420; }
    table tbody td:first-child { border-left: none; }
    table tbody tr:last-child td { border-bottom: none; }
    table tfoot td div { border-top: 1px solid #36752D;background: #DFFFDE;}
    table tfoot td { padding: 0; font-size: 12px }
    table tfoot td div{ padding: 2px; }
    table tfoot td ul { margin: 0; padding:0; list-style: none; text-align: right; }
    table tfoot li { display: inline; }
    table tfoot li a { text-decoration: none; display: inline-block; padding: 2px 8px; margin: 1px;color: #FFFFFF;border: 1px solid #36752D;-webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; background:-webkit-gradient( linear, left top, left bottom, color-stop(0.05, #36752D), color-stop(1, #275420) );background:-moz-linear-gradient( center top, #36752D 5%, #275420 100% );filter:progid:DXImageTransform.Microsoft.gradient(startColorstr=’#36752D’, endColorstr=’#275420′);background-color:#36752D; }
    table tfoot ul.active,
    table tfoot ul a:hover { text-decoration: none;border-color: #275420; color: #FFFFFF; background: none; background-color:#36752D;}

    Vi hörs!
    /Anders

  2. Hi!
    I’m a bit late to the show here. But I really want to say thank you for this Mikael :)
    I have my MDT Monitor web page up and running now and there is two things i’m curious about. I’m trying to tweak it a bit and I would like to display the value for “Elapsed Time” that is present under monitoring in the MDT Workbench. But I can’t find any matching value for that under $Data.content.properties. Any idea where the MDT Workbench gets that number from?
    Also, where does the monitoring get the start time/end time from? I’ve noticed that the time on the monitoring page is always based on UTC even though the Time Zone on my server is set to UTC +01:00

  3. Is there a way to display the Step.Name on the webpage? I’m able to get currentstep and totalsteps to display fine but for some reason I can’t figure out what the $property is for stepname.

    • Isn’t it just $property.StepName ? It’s what I’m using at least and it displays the name of the steps for me. Not all steps seems to report an actual name though.

      • There is also one otherway to do it. It is basically the old way that was used by the OpsMgr integration, but yes you could read/use StepName, but it does not give you all steps and all actions, since they have not been defined in the TS to send a message.

      • Interesting. I’m looking forward to see what that other way to do it is :) It would also be great if there was some darn way to adjust that time zone as well.

      • Ideally the MDT monitor service would adjust itself for timezone and daylight saving according to the regional settings on my server. But as far as i’ve understood it that is not possible. So I’m guessing you have to adjust it yourself in the powershell script? Anyway. The timezone I would like it to be is UTC +01:00 (Stockholm)

  4. To show current step add:
    CurrentStep = $($property.CurrentStep.’#text’);

    And CurrentStep at the bottom

    Let me know if you find the solution for changing the date. I am looking to adjust the time by -5

    • Found a solution for the date, just adjust the hour difference within the AddHours()

      StartTime = $(Get-Date ($property.StartTime.’#text’)).AddHours(-5);
      EndTime = $(Get-Date ($property.EndTime.’#text’)).AddHours(-5);

      • Thanks! That works great. Do you know if there is a way to get a -format in there for Get-Date? For example ‘Get-Date -format s’

  5. Here is another useful command to add if you are starting encryption within the deployment process. I have only confirmed this works for Windows 10 deployments. Since the command is ran while building the webpage, you will notice a period the page does not show any deployment statuses until it finishes. You may want to adjust the time of your task manager depending on the amount of deployments you have at one time. I would like to add a statement to see if the computer is online before running the command to reduce the time it takes for the webpage to build. Any suggestions?

    VolumeStatus = $(Invoke-Command -ComputerName $property.Name -ScriptBlock {(Get-BitLockerVolume).VolumeStatus});
    EncryptionPercentage = $(Invoke-Command -ComputerName $property.Name -ScriptBlock {(Get-BitLockerVolume).EncryptionPercentage});

  6. one of them stupid questions perhaps but i would really like to know… i would really like to be able to show which tasksequence that the current computer is being installed through. i have tried to reverse engineer the script in order to get it to show all properties but nothing works.
    right now i have edited the script to include the following headline:
    Name | DeploymentStatus | TaskName (empty) | TotalSteps | CurrentStep | StepName | PercentComplete | StartTime | LastTime | EndTime | Warnings | Errors

    How do i fill in the TaskName property?

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.