Create a script based monitor for the existence of a file, with recovery to copy file


<!--[if lt IE 9]>

<![endif]-->


Comments (8)

  1. Kevin Holman says:

    David’s example is a good one – however that was exactly my point – he is passing the output of the monitor state as a parameter to the script. There are actually a lot of examples on the web about how to do this. My blog post was how to take an output from the monitor, and use it in a condition detection of a recovery, which is unique, and the syntax changes.

  2. Anonymous says:

    SCOM has many different ways to monitor for a file size. Here are some simple examples using script and

  3. Sunil_03 says:

    Hi Kevin thanks for the post,
    Can we modify the script for two parameters.

    File age should ne less than 10 minutes than only alert should come and auto resolve after 30 minutes.
    file name contains the date also in the name , is it possible to include wildcard option in the file name here as the file gets created whenever any job fails.
    so we have multiple files with the common name with date mentioned

    For eg hs_data_1103,hs_data_1203.

    Thanks
    Sunil

  4. Hi Kevin,

    I have a script which test the share availability.

    I am trying to create a script based monitor, when the share doesn’t exit I want a alerts. The script looks good however in the monitor I am bit confused what Expressions I have to use for Health and Unhealthy. Below is the script.

    =====================================================
    Dim objFSO, strRevBackupServerPath, strNetworkPathFolder

    strRevBackupServerPath="\inb-om2012R2labTest"

    Set objFSO = CreateObject("Scripting.FileSystemObject")

    If objFSO.FolderExists(strRevBackupServerPath & strNetworkPathFolder) Then
    Wscript.Echo "Share Exists"

    Else
    WScript.Echo "Share Does Not Exist"

    End If
    ========================================================

    Any assistance in this is Highly appreciated.

    Regards,
    Satish Phatge.

  5. Andre says:

    Good Day Kevin,

    Fantastic post, very informative, however: how does the VBScript Execute? For instance, if you have a gateway server where the server is contactable through that gateway, will the VBScript run on the Gateway where the server is managed? regards

  6. Jim Anderson says:

    yes… is a wildard option possible?

  7. Steve says:

    Hi Kevin, I’m having trouble with a script very similar to yours and I was wondering if you could provide some insight.
    I’m also using fso.FolderExists(folder) to test for existence of a folder, but when run from SCOM this always fails to see the folder. Have tried with local system and also a domain account as action account. If run locally on the server the script always sees the folder, regardless of which account runs it.
    I’ve also created a PowerShell version of the script using Test-Path but am getting the same results – always fails to see the folder when run from SCOM, always succeeds when run locally.
    Any thoughts on what’s going on here?
    Cheers, Steve

Skip to main content