<Rule ID="Quest.One.ActiveRoles.Rules.Event.ServiceGeneralResponse" Enabled="true" Target="Windows!Microsoft.Windows.Computer" ConfirmDelivery="false" Remotable="true" Priority="Normal" DiscardLevel="100">
<Category>EventCollection</Category>
<DataSources>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedScript.EventProvider">
<IntervalSeconds>300</IntervalSeconds>
<SyncTime/>
<ScriptName>ARSPServiceGeneralResponse.vbs</ScriptName>
<Arguments>$Target/Property[Type="Windows!Microsoft.Windows.Computer"]/NetworkName$ True</Arguments>
<ScriptBody><Script><![CDATA['*************************************************************************
' Script Name - ActiveRoles Service: General response
'
' Purpose - Monitors the general responsiveness of ActiveRoles Service on Local host
'
' Assumptions - Script is run by a timed event
'
' Parameters - ComputerName - Computer name
' LogSuccessEvent - True/False value to indicates to log an
' an event for script success
' (useful for demos and debugging)
'
' (c) Copyright 2004-2012, Quest Software, All Rights Reserved
'*************************************************************************
Option Explicit
' Product name dependent constants
Const EDM_UNAVAILABLE_STRING = "ActiveRoles Service is unavailable."
Const EDM_AVAILABLE_STRING = "ActiveRoles Service is available."
Const EDM_EMPTY_SCHEMA_VERSION_STRING = "ActiveRoles Schema Version is empty."
Const EDM_SERVICE_IS_NOT_STARTED_STRING = "ActiveRoles Service is not started."
Const EDM_SERVICE_IS_NOT_INSTALLED_STRING = "ActiveRoles Service is not installed."
Const EDM_SERVICE_NAME_STRING = "arssvc"
Const SCRIPT_NAME = "ActiveRoles Service: General response"
' Check that EDM service is installed and is started
sMessage = CheckEDMService
If Len(sMessage) <> 0 Then
CreateEvent EDM_UNAVAILABLE_EVENT_ID, EVENT_TYPE_ERROR, SCRIPT_NAME, sMessage
Exit Sub
End If
' Check that EDM service is completely started
Set oEDMS = GetObject("EDMS:")
Set oRGContainer = oEDMS.OpenDSObject (sRGContainerAdsPath, "", "", &H8000&)
If Err.Number <> 0 Then
sMessage = EDM_UNAVAILABLE_STRING & sSeparator & Err.Description
CreateEvent EDM_UNAVAILABLE_EVENT_ID, EVENT_TYPE_ERROR, SCRIPT_NAME, sMessage
Exit Sub
End If
' Get EDM schema version to check EDM service availability
nSchemaVer = GetEDMSchemaVersion
If Err.Number <> 0 Then
sMessage = EDM_UNAVAILABLE_STRING & sSeparator & Err.Description
CreateEvent EDM_UNAVAILABLE_EVENT_ID, EVENT_TYPE_ERROR, SCRIPT_NAME, sMessage
Else
If Len(nSchemaVer) = 0 Then
sMessage = EDM_UNAVAILABLE_STRING & sSeparator & EDM_EMPTY_SCHEMA_VERSION_STRING
CreateEvent EDM_UNAVAILABLE_EVENT_ID, EVENT_TYPE_ERROR, SCRIPT_NAME, sMessage
Else
If bLogSuccessEvent Then
sMessage = EDM_AVAILABLE_STRING
CreateEvent EDM_AVAILABLE_EVENT_ID, EVENT_TYPE_INFORMATION, SCRIPT_NAME, sMessage
End If
End If
End If
End Sub
Function GetEDMSchemaVersion()
Dim oEDMS, oRootDSE, oSchema
Dim sSchemaNC, sSchemaVer
Sub CreateEvent(lngEventID, lngEventType, strEventSource, sMessage)
Dim oAPI, oBag
Set oAPI = CreateObject("MOM.ScriptAPI")
Set oBag = oAPI.CreatePropertyBag()
Call oBag.AddValue("EventId", lngEventID)
Call oBag.AddValue("EventType", lngEventType)
Call oBag.AddValue("EventSource", strEventSource)
Call oBag.AddValue("EventLog", sMessage)
Call oAPI.Return(oBag)
End Sub
Function CheckEDMService()
On Error Resume Next
Dim oWmiSvc, colItems, oEdmSvc, path
CheckEDMService = ""
' Check that ActiveRoles Service is installed and started
path = "WINMGMTS:{impersonationLevel=impersonate}!\\" & ComputerName & "\root\cimv2:Win32_Service='" & EDM_SERVICE_NAME_STRING & "'"
Set oEdmSvc = GetObject(path)
If oEdmSvc Is Nothing Then
CheckEDMService = EDM_UNAVAILABLE_STRING & sSeparator & EDM_SERVICE_IS_NOT_INSTALLED_STRING
Exit Function
End If
If oEdmSvc.Started = false Then
CheckEDMService = EDM_UNAVAILABLE_STRING & sSeparator & EDM_SERVICE_IS_NOT_STARTED_STRING
End If