While you can always see what PRO is doing at any given time, by simply opening up the VMM console and navigating to the PRO tips window. From there you can see any active, executing, or failed PRO tips. But you may be wondering how you track or report on what PRO has done in the past. This is actually very easy to do. All of the PRO tips are stored in the VMM database and this data is pruned on the same schedule as the jobs data. As with everything in VMM you can see this information both from the UI as well as PowerShell. I am going to walk you through how to get this data from both sources.

PRO History From The UI

Open up the VMM console and navigate to the jobs view. You will notice that all jobs which have been initiated by a implementing a PRO tip will show the PRO Tip ID as a link in the details pane. Clicking on this link will automatically filter the jobs in the list to show only the jobs which were initiated as a result of the respective PRO tip. You will also notice an additional tab in the details pane called PRO Tip. Clicking on this tab will show the details of the original PRO Tip.

clip_image002

The PRO tip details of the PRO tip which initiated the selected job:

clip_image004

While having this data in the console is really beneficial and also easy to use. I also wanted to take a look at how you would access this data from PowerShell and potentially start to use this data to generate your own reports.

In order to access this data the main cmdlets that we are going to use are Get-PROTip (which returns a list of PRO Tip objects) and Get-Job (which returns a list of Job objects).

First thing let’s take a look at what the PROTip and Job objects look like. For this I am going to use PowerShell’s Get-Member cmdlet to output the properties of each of those objects.

PROTip object properties

clip_image006

Job object properties:

clip_image008

The important thing to notice is the common property between the two objects is the PRO Tip Id. On the PROTip object this is simply the ID property and on the job object this is the PROTipID property. On the PROTip object this is property is a unique identifier for each PROTip that is generated. On the Job object the PROTipID property is the Id of the specific PROTip that initiated that job. Now that we have a common key between the two objects we can link the two data sets and get meaningful data out of VMM.

Before we take a looks at a full report, let’s take a look at what some of the Jobs associated with a PRO tip looks like.

clip_image010

Let’s take a look at what is here. There are a few jobs called Set state of a PRO tip, and one Move virtual machine…. The Set state jobs are actually internal jobs that are used to update the state and details of the PRO tip as it executes. When authoring PRO enabled MPs (that’s a whole different post), authors will update the status and details of the pro tip throughout its life to ensure that VMM knows what’s going on.

PRO Tip Job Report

So now we get to the report its self. I have written the following simple script, to generate a file which contains the information I am interested in. I have done some basic formatting, but you can make this a lot more interesting. In this case I am generating a report which shows the list of Jobs which were executed for each PRO tip in a Closed state. While the Set PRO Tip state jobs are important for tracking and auditing the life of PRO tip, I am going to ignore those jobs and leave them out of my report.

#Connect to the VMM Server

Get-VMMServer <YourVMMServerName>

#Reset the width of the report to reduct line wrap

$bufferSize = new-object System.Management.Automation.Host.Size 160,200

$host.UI.RawUI.BufferSize = $bufferSize

#Get all of the PRO Tips and Jobs

$PT = (Get-PROTip | Where {$_.StatusString -eq 'Closed'} | Sort CreatedTime)

$jobs = Get-Job | Where {$PROTipId -ne ''}

#Setup the report file with a header

("#"*20) | Out-File 'c:\scripts\report.txt'

("#PRO Summary Report - " + (Get-Date).ToString()) | Out-File 'c:\scripts\report.txt' -Append

("#"*20) | Out-File 'c:\scripts\report.txt' -Append

"" | Out-File 'c:\scripts\report.txt' -Append

"" | Out-File 'c:\scripts\report.txt' -Append

#Loop through the PRO Tips

foreach($x in $PT)

{

#add a line to mark the PRO Tip

("#"*5)+"PRO Tip: " + $x.Id + ("#"*50) | Out-File 'c:\scripts\report.txt' -Append

#output the PRO Tip details

$x | Format-Table CreatedTime, Name, Source -Verbose -Wrap -AutoSize | Out-File 'c:\scripts\report.txt' -Append

#add a line to mark the start of the list of jobs

("*"*5)+"Excuted Jobs"+("*"*20) | Out-File 'c:\scripts\report.txt' -Append

#Output the list of Jobs

($jobs | Where {($_.PROTipId -eq $x.Id) -and ($_.CmdletName -ne 'set-PROTip')} | Sort StartTime)| Format-Table StartTime, Status, Name -Verbose -Wrap -AutoSize | Out-File 'c:\scripts\report.txt' -Append

}

Sample Report output:

####################

#PRO Summary Report - 3/27/2009 11:49:06 AM

####################

#####PRO Tip: 7875d70a-8b6d-442b-8116-b0acbee5207b##################################################

CreatedTime Name Source

----------- ---- ------

3/26/2009 2:03:29 PM PRO CPU Utilization HOST02.contoso.com

*****Excuted Jobs********************

StartTime Status Name

--------- ------ ----

3/26/2009 2:03:50 PM Completed Move virtual machine from HOST02.contoso.com to HOST03.contoso.com using cluster

#####PRO Tip: c71fadd9-865e-4a09-b38c-3164264f8f14##################################################

CreatedTime Name Source

----------- ---- ------

3/26/2009 2:03:29 PM PRO CPU Utilization HOST01.contoso.com

*****Excuted Jobs********************

StartTime Status Name

--------- ------ ----

3/26/2009 2:03:52 PM Failed Move virtual machine from HOST01.contoso.com to HOST03.contoso.com using cluster

Hope you find this helpful!

Alan Goodman

Senior Program Manager

System Center Virtual Machine Manager