We all know how to view RunAs accounts associated with RunAs profile being inside UI.
Like this. Administration->Profiles. Voilà.

Ho to do the same enumeration from PowerShell?

#connect to management group
$mg = new-object Microsoft.EnterpriseManagement.ManagementGroup("localhost")
#get 'Default Action Account' profile and assign its ID to variable
$RunAsProfileId = (Get-SCOMRunAsProfile -DisplayName 'Default Action Account').Id
# get Health Service array associated with the profile
#enumerate accounts
$HSref | %{$_.GetMonitoringSecureData().Name}</code>

Another interesting thing came to my attention was about SCOM alerting and attachments.

Since SCOM was born (fall of 2006) and till present days SCOM poorly supports HTML rich text email and completely ignores (does not support)  attachments.
For us it means we can’t add additional information into alerts by means of standard SCOM capabilities and need to invent wheels every time we need to attach something. 

It had been true for a long time until SP1 was released for SCOM 2012. Since SP1 we can add attachments into email. 
But again, this is not documented well and as of now is used by APM and GSM modules for their own needs.

It’s a good R&D task. I eager to put my fingers into this topic. Stay tuned.

Good start point is the following blogpost of :

OM12 SP1 Q & A: Meet The Alert Attachment MP

  1. Is this functionality present by default in SCOM 2012 SP1?
  2. When this(Alert Attachments) MP is imported I am all set?
  3. OK, I have configured the MP and setup the file share. Now ALL the Alerts will have additional information attached to it?
  4. Can you tell me what MPs these might be?
  5. So I need to configure Team Foundation Server (TFS) as well? And how?
  6. So basically I can’t select what Alert will have additional information attached to it?
  7. I don’t use APM nor GSM. So changes are the Alert Attachment MP isn’t meant for me?

Together with my old fellow MVP Bob Cornelissen and friend of him David Scheltens we have recently created community SCOM management pack for measuring MS SQL IOPS.
The MP is finally polished and is posted MS Technet gallery.

Starting SQL 2005 SQL DBA’s have the possibility to use Dynamic Management Views and Functions to monitor the health of a server instance, diagnose problems, and tune performance. This management pack is specifically geared towards the sys.dm_io_virtual_file_stats view, which returns I/O statistics for data and log files. The view is used by DBA’s to view current counter values for each database file (data or log). It is a current point in time and these values are cumulative values since the last restart of the server. This management pack collects these values for use in viewing and reporting. There are no health state changes or alerts connected to these values.
This Management Pack is provided free of charge by the authors to the System Center community.


Writers of this management pack:
Bob Cornelissen. Microsoft MVP System Center Cloud and Datacenter Management, Managing Consultant of BICTT in the Netherlands, Author of the book Mastering System Center 2012 Operations Manager.
David Scheltens. Senior SQL DBA and Owner of Multibyte in the Netherlands.
Pavel Dzemyantsau. Chief IT Engineer at EPAM Systems in Belarus. Contributor to the book Mastering System Center 2012 Operations Manager.

it has been hidden for ages 🙂

we do have a way to set dynamic severity or priority for SCOM 2007/2012 Alert Rule

all we need is to author it as follows:

<WriteAction ID="RuleId.WriteAction" TypeID="Health!System.Health.GenerateAlert">

something about this

$groupDisplayName = 'GROUP_X'
$groupId = Get-MonitoringClass | ?{$_.DisplayName -eq $groupDisplayName} | %{$_.Id}
Get-NotificationSubscription  | %{$notificationName = $_.DisplayName;$_.Configuration| %{ if($_.MonitoringObjectGroupIds -eq $groupId){$notificationName}}}

In series of blog posts i’m going to show advanced technique of web application monitoring scenarios for SCOM.
This technique does not use standard Web Application template and is based on IE Automation.

I start from raw data for now. Later will add more details.

Part1: IE Automation.

Again, for now i’m just posting raw data.


  1. OpenStartPage https://login.live.com/.
  2. Check if elements User, Pass, SignIn are loaded
  3. Fill in User, Pass
  4. Click ‘SignIn’
  5. Check if ‘LiveId’ DOM element is loaded
  6. Get LiveID DOM element value and compare it with provided User
  7. Report scenario time

On each step script tries to report HTTP/Timeout errors and stops script execution.

'Author: Pavel Dzemyantsau
'Note:   Demonstrates POC of IE Automation for LiveID login.


'create automation object
Set oIE = WScript.CreateObject("InternetExplorer.Application","IE_")

Timeout=60 'seconds
oIE.visible=1 : BeginTimer = Timer
oIE.Navigate strURL
i=0 : bElementsLoaded=false
Set DOM_Element_1 = Nothing : Set DOM_Element_2 = Nothing : Set DOM_Element_3 = Nothing
Do While (oIE.ReadyState<>4 Or Not(bElementsLoaded)) And i < Timeout
   On Error Resume Next
      Set DOM_Element_1 = oIE.Document.getElementById("i0116")           'User
      Set DOM_Element_2 = oIE.Document.getElementById("i0118")           'Password
      Set DOM_Element_3 = oIE.Document.getElementById("idSIButton9") 'SignIn button
      If     (Not(DOM_Element_1 is Nothing)) _
         And (Not(DOM_Element_2 is Nothing)) _
         And (Not(DOM_Element_3 is Nothing)) Then
       'all elements we are going to use are loaded
      End If
   On Error Goto 0

If Not bElementsLoaded  Then
  WScript.Echo "Timeout"&Timeout&" seconds occured on action TODO:."
End If

'Fill in User/Pass
DOM_Element_1.value=strUser 'TODO: loop to check if user has been set
DOM_Element_2.value=strPass 'TODO: loop to check if pass has been set

Timeout=120 'seconds
i=0 : bElementsLoaded=false
Set DOM_Element_1 = Nothing
Do While (oIE.ReadyState<>4 Or Not(bElementsLoaded)) And i < Timeout
   On Error Resume Next
      Set DOM_Element_1   = oIE.Document.getElementById("idWinLiveIdValue") ' LiveId
      If (Not(DOM_Element_1 is Nothing)) Then
       'element we are going to use is loaded, now is checking its attrubute 'title'
        Set DOM_Element_1_attribute_1 = DOM_Element_1.attributes.getNamedItem("title")
           If Not (DOM_Element_1_attribute_1 is Nothing) Then
              'attribute found
              If LCase(DOM_Element_1_attribute_1.value) = LCase(strUser) Then
                'attribute title has correct value
              End If
           End If
      End If
   On Error Goto 0
EndTimer = Timer

If Not bElementsLoaded  Then
  WScript.Echo "Timeout"&Timeout&" seconds occured on action TODO:."
End If

Wscript.Echo "Scenario time(sec): "& (EndTimer-BeginTimer)

oIE.Stop : WScript.Sleep(5000) : oIE.Quit

Sub IE_NavigateError(ByVal pDisp,ByVal URL,ByVal TargetFrameName,ByVal StatusCode,ByRef Cancel)
    WScript.Echo "StatusCode="&StatusCode
End sub

Just found an issue with SCOM 2007 R2 CU5 when updating from CU4. According to the deployment guide
Microsoft.SystemCenter.Library MP could have been updated to version 6.1.7221.81

But… update process fails to do this when you have CU4 installed.
According to KB this MP is supposed to be updated by CU5_Database.sql.

Looking into the script I easily identified “bottleneck”

DECLARE @ver nvarchar(25)
 DECLARE @compare int
 SET @ver = (SELECT Mpversion FROM ManagementPack WHERE MPName = 'Microsoft.SystemCenter.Library')
 -- Update Microsoft.SystemCenter.Libarary MP directly via SQL
 SET @compare = dbo.fn_VersionCompare (@ver, '6.1.7221.50')
 IF( @compare = -1)
 EXEC [dbo].[p_MPImportXML]
 @ManagementPackXML = N'

with CU4 installed Line 3 of the code sets @ver to ‘6.1.7221.61’.
Function ‘dbo.fn_VersionCompare’ does smart compare of two strings and returns

  • -1 if string1 is less than string2
  • 0 if strings are equal
  • 1  if string1 is greater than string2

with @ver=’6.1.7221.61′  function returns 1, this blocks update procedure to happen.

Once I identified where issue is. Let’s think about next steps.

There are tree options:

  1. download updated MP and import it from SCOM console. This is NOT recommended by Microsoft. There is a negative side affect: you may loose all connectors and will have to restore OpsDB from backup. See KB article for more details: http://support.microsoft.com/kb/2590414
  2. or correct CU5_Database.sql as follows:
    SET @compare = dbo.fn_VersionCompare (@ver, '6.1.7221.81')

    this is unsupported way. Follow at your own risk. I followed 🙂 and now have .81 MP installed.

  3. do nothing

Being IT geek I couldn’t help continuing and tried to compare two versions of the same MP.

doing this i’m trying to answer a question:

  • was this MP really updated from previous CU or it is just republish with new version number?

We have:
Microsoft.SystemCenter.Library.mp CU4 6.1.7221.61
Microsoft.SystemCenter.Library.mp CU5 6.1.7221.81

Loading both versions into notepad++ with compare plugin installed and clicking “Compare”….I see the only ONE difference and this line is MP Version.

so, option three is the right answer to the question: what to do next.