Hello,
I am running through a monitor http://stefanroth.net/2011/12/04/simple-script-which-checks-the-modified-time-hours-of-a-log-file/
the following script:
' Enter a script that outputs a property bag
' Example VBScript:
'
' Dim oAPI, oBag
' Set oAPI = CreateObject("MOM.ScriptAPI")
' Set oBag = oAPI.CreatePropertyBag()
' Call oBag.AddValue("Status","OK")
' Call oAPI.Return(oBag)
Dim oArgs
Set oArgs = WScript.Arguments
Dim oAPI
Set oAPI = CreateObject("MOM.ScriptAPI")
Dim objFile
Dim ValueToReturn
Dim oFso
Dim oFile
Dim oBag
Dim Filename
Dim DateLastModified
Set oFso = CreateObject("Scripting.FileSystemObject")
'Path to the log file
Filename = "C:\Program Files\Tivoli\TSM\TDPSql\dsm.opt"
If (oFso.FileExists(Filename)) Then
Set objFile = oFso.GetFile(Filename)
DateLastModified= objFile.DateLastModified
'Here we just pick the hours of the time stamp. Since we are having 24-hour time notation it is easy to pick the hour-part e.g. 05:00 it would pick the “5” or in 16:00 it would pick the “16”.
If DatePart("h",objFile.DateLastModified) < 5 Then
ValueToReturn = "OK"
Else
ValueToReturn = "FAILED"
End If
Else
'Here you just could pick the return value 9999 if an error occurs e.g. for use in an three state monitor
ValueToReturn = 9999
End If
Set oBag = oAPI.CreatePropertyBag()
Call oBag.AddValue("Status",ValueToReturn)
Call oBag.AddValue("Filename",Filename)
Call oBag.AddValue("DateLastModified",DateLastModified)
Call oAPI.Return(oBag)but I am getting errors in the OperationsManager log:
The Microsoft Operations Manager Expression Filter Module failed to query the delivered item, item was dropped.
Property Expression: Property(@Name='Status')
Error: 0x80004005
One or more workflows were affected by this.
Workflow name: UIGeneratedMonitor0bddd05a81554849aa07dac795e7988b
Instance name: SOPFCSRS1.ad
Instance ID: {796FBC55-3410-0E58-620D-DE722D4E710F}
Management group: SCOM-MEDand
The Microsoft Operations Manager Expression Filter Module failed to query the delivered item, item was dropped.
Property Expression: Property(@Name="Status")
Error: 0x80004005
One or more workflows were affected by this.
Workflow name: UIGeneratedMonitor0bddd05a81554849aa07dac795e7988b
Instance name: SOPFCSRS1.ad
Instance ID: {796FBC55-3410-0E58-620D-DE722D4E710F}
Management group: SCOM-MEDif I run the same script locally I have no error:
C:\Users\Dominiqued\Desktop>cscript dsmopt1.vbs Microsoft (R) Windows Script Host Version 5.7 Copyright (C) Microsoft Corporation. All rights reserved.<DataItem type="System.PropertyBagData" time="2014-08-25T13:54:43.4252462-07:00" sourceHealthServiceId="50600275-DDCF-6A10-2993-5B437808E26A"><Property Name="St atus" VariantType="8">FAILED</Property><Property Name="Filename" VariantType="8">C:\Program Files\Tivoli\TSM\TDPSql\dsm.opt</Property><Property Name="DateLastMo dified" VariantType="7">08/25/2014 13:00:22</Property></DataItem> C:\Users\Dominiqued\Desktop>
why from SCOM I am getting an "access denied" or...?
Thanks,
Dom
System Center Operations Manager 2007 / System Center Configuration Manager 2007 R2 / Forefront Client Security / Forefront Identity Manager