Compartilhar via


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

<!--[if lt IE 9]>

<![endif]-->

Comments

  • Anonymous
    January 01, 2003
    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.
  • Anonymous
    March 19, 2014
    The comment has been removed
  • Anonymous
    July 09, 2014
    SCOM has many different ways to monitor for a file size. Here are some simple examples using script and
  • Anonymous
    August 10, 2015
    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
  • Anonymous
    October 29, 2015
    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.
  • Anonymous
    November 07, 2016
    The comment has been removed
  • Anonymous
    March 31, 2017
    yes... is a wildard option possible?
  • Anonymous
    June 14, 2017
    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