2012-12-19

I have a rule in MOM which I need to migrate to SCOM. It runs a script which counts the number of rows returned from a table on a database and if the value is greater than 50, generate and email and if the value is greater than 200 generate another email. Here's the script:

Const DB_CONNECT_STRING = "Provider=SQLOLEDB.1;Data Source=MyDBServer; Initial Catalog=MyDatabase;user id = 'MyUser';password='MyPassword'"

Const EVENT_TYPE_SUCCESS = 0

Const EVENT_TYPE_ERROR   = 1

Const EVENT_TYPE_WARNING = 2

Const EVENT_TYPE_INFORMATION = 4

Const EVENT_TYPE_AUDITSUCCESS = 8

Const EVENT_TYPE_AUDITFAILURE = 16

Const EVENT_SUCCESS = 0

GetQueueCount

Sub GetQueueCount()

Dim myConn

Dim myRecordset

Dim sqlText

Dim rstCount

Dim strLevelOne, strLevelTwo, strLevelThree

strLevelOne = ScriptContext.Parameters.Get("ThresholdLevelOne")

strLevelTwo = ScriptContext.Parameters.Get("ThresholdLevelTwo")

sqlText = "select count(*) as Result from MyTable with (nolock) where Status = 'c' and ShipRegisterID = ''"

set myConn = CreateObject("ADODB.Connection")

set myRecordset = CreateObject("ADODB.Recordset")

myConn.Open = DB_CONNECT_STRING

myRecordset.Open sqlText, myConn

rstCount = myRecordset.Fields("Result").Value

myConn.Close

If rstCount > Cdbl(strLevelTwo) Then

CreateEvent 202,1,"Solomon Sales Journal","Queue is currently at " & rstCount & " records."

elseif rstCount >=  Cdbl(strLevelOne) then

CreateEvent 102,2,"Solomon Sales Journal","Queue is currently at " & rstCount & " records."

End if

End Sub

Sub CreateEvent(intEventNumber,intEventType,strEventSource,strEventMessage)

Set objEvent = ScriptContext.CreateEvent()

objEvent.EventNumber = intEventNumber

objEvent.EventType = intEventType

objEvent.EventSource = strEventSource

objEvent.Message = strEventMessage

ScriptContext.Submit objEvent

End Sub

To emulate this in SCOM 2012, here's what I've done:

1. I created an OLE DB Data Source with the following entries:

Name: Check My Sales Journal Queue

Connection String: Provider=SQLOLEDB;Server=MyDBServer;Database=MyDatabase;User Id=$RunAs[Name="OleDbCheck_343fb9631393453e99d4cb24af9c55c0.SimpleAuthenticationAccount"]/UserName$;Password=$RunAs[Name="OleDbCheck_343fb9631393453e99d4cb24af9c55c0.SimpleAuthenticationAccount"]/Password$

Query To Execute: select count(*) as Result from MyTable with (nolock) where Status = 'c' and ShipRegisterID = ''

Authentication: Simple

I then created an account called "My Sales Journal Queue RunAs Account" with the local MS SQL DB username & password (not a domain user) and limited the distribution to MyDBServer.

When creating an OLE DB Data Source, SCOM automatically creates two new RunAs Profiles called:

* Check My Sales Journal Queue OLE DB Simple Authentication Profile

* Check My Sales Journal Queue OLE DB Synthetic Transaction Action Profile

Based on the fact that I chose the Simple Authentication in the OLE DB Data Source, I placed the RunAs account "My Sales Journal Queue RunAs Account" into the RunAs Profile "Check My Sales Journal Queue OLE DB Simple Authentication Profile".

I then went back to the OLE DB Data Source, opened it up and clicked the Test button but I get this error:

An object of class ManagementPackSecureReference with ID 6F4D63CA-AF67-E28D-64DC-9E3D805EDA72 was not found.

The Stack Trace shows the following:

Note:  The following information was gathered when the operation was attempted.  The information may appear cryptic but provides context for the error.  The application will continue to run.

Microsoft.EnterpriseManagement.Common.ObjectNotFoundException: An object of class ManagementPackSecureReference with ID 6f4d63ca-af67-e28d-64dc-9e3d805eda72 was not found.

at Microsoft.EnterpriseManagement.Common.Internal.ServiceProxy.HandleFault(String methodName, Message message)

at Microsoft.EnterpriseManagement.Runtime.TaskRuntimeServiceProxy.SubmitTasks(IList`1 jobDefinitions, Guid batchId, JobCategory category, Boolean registerCallback)

at Microsoft.EnterpriseManagement.Runtime.TaskRuntimeManagement.SubmitTaskInternal(ICollection`1 targetIds, Guid taskId, TaskConfiguration configuration, TaskStatusChangeCallback callback)

at Microsoft.EnterpriseManagement.Runtime.TaskRuntimeManagement.SubmitTaskInternal[T](IEnumerable`1 targets, Guid taskId, TaskConfiguration configuration, TaskStatusChangeCallback callback)

at Microsoft.EnterpriseManagement.Runtime.TaskRuntimeManagement.BeginExecuteTaskInternal[T](IEnumerable`1 targets, Guid taskId, TaskConfiguration configuration, AsyncCallback callback, Object state)

at Microsoft.EnterpriseManagement.Runtime.TaskRuntimeManagement.BeginExecuteTask[T](IEnumerable`1 targets, ManagementPackTask task, TaskConfiguration configuration, AsyncCallback callback, Object state)

at Microsoft.EnterpriseManagement.Internal.UI.Authoring.Pages.ChooseOleDbConfigPage.RunTask(Object sender, ConsoleJobEventArgs e)

at Microsoft.EnterpriseManagement.Mom.Internal.UI.Console.ConsoleJobExceptionHandler.ExecuteJob(IComponent component, EventHandler`1 job, Object sender, ConsoleJobEventArgs args)

I checked that the account can log into the MS SQL database and it works fine using the MS SQL Management Studio. So what does this error mean?

Show more