Quantcast
Channel: Operations Manager - General forum
Viewing all articles
Browse latest Browse all 11941

Script Monitoring for dynamic log file existence in SCOM.

$
0
0

How do we monitor log file existence with a dynamic name ? for example test_MMDDYYYY.txt

vbs script is fine but what should we specify under <arguments></argument> ?

The current script is checking file existence for name only "testing_" and not for any particular date 

<ScriptName>ShowTime.vbs</ScriptName>
  <Arguments>"E:\Temp\testing_"</Arguments>
  <ScriptBody>
    dim cdate
    Dim FSO
    dim filename
    dim cday, cmonth, cyear
    dim mdate

    On Error Resume Next
    Set oAPI = CreateObject("MOM.ScriptAPI")
    Set oBag = oAPI.CreatePropertyBag()
    Set oArgs = WScript.Arguments
    strComputer = "."
    strState = "NotExists"

    cday = Day(date())
    cmonth= Month(date())
    cyear= Year(date())

    if Len(cday) =1 then
    cday="0" + cday
    end if

    if Len(cmonth) =1 then
    cmonth="0" + cmonth
    end if

    cdate= cday +cmonth +cyear + ".txt"

    oArgs(0) = oArgs(0) +cdate

    Set FSO = CreateObject("Scripting.FileSystemObject")

    Set objFSO = CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists(oArgs(0)) Then
    strState = "Exists"
    End If

    WScript.Echo strState
    Call oBag.AddValue("Name",oArgs(0))
    Call oBag.AddValue("State",strState)
    Call oAPI.Return(oBag)


Viewing all articles
Browse latest Browse all 11941

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>