locked
Folder size monitoring & reporting RRS feed

  • Question

  • Hi All,

     

    I've got a question regarding a thing I run in to.

    I'm looking for a way to monitor the size of folders in SCOM, all folders are located on the same drive and are used for departmental data.

    We want to monitor the size of the folders and make monthly reports to charge departments for the space they are using.

     

    Is there any quick way to do this? I've looked up some scripts but nothing meets my requirements, they're all about file counts etc. So before I start scripting myself, I thought to check in here :-)

     

    Regards,

     

    Yorick

     

    Friday, April 18, 2008 5:35 AM

Answers

All replies

  • Maybe this script will fit your needs:

     

    Const EVENT_TYPE_SUCCESS = 0
    Const EVENT_TYPE_ERROR   = 1
    Const EVENT_TYPE_WARNING = 2
    Const EVENT_TYPE_INFORMATION = 4
    Const EVENT_TYPE_AUDITSUCCESS = 8
    Const EVENT_TYPE_AUDITFAILURE = 16

    strComputer = "."


    Set WMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
    WMIQuery = "Select FileSize from CIM_DataFile where drive = 'C:' and Path = '\\Windows\\System32\\LogFiles\\W3SVC1\\'"
    Set Results = WMIService.ExecQuery(WMIQuery)

    SumFiles = 0

    For Each FileFound In Results
        SumFiles = SumFiles + FileFound.FileSize
       
    Next

    'Calculation for Megabytes
    SumFiles = SumFiles / 1048576
    SumFiles = Round(SumFiles,3)

    'My threshold is 5 megabytes
        If SumFiles >= 5 Then
            CreateEvent 100,EVENT_TYPE_ERROR,"File Size Checker","The monitored resource has currently reached a threashold greater then 5 megabytes," & SumFiles
        Else
            CreateEvent 200,EVENT_TYPE_INFORMATION,"File Size Checker","The monitored resource is currently within acceptable bounds (below 5 megabytes) " & SumFiles
        End If


    Sub CreateEvent(intEventNumber,intEventType,strEventSource,strEventMessage)
        Set objEvent = ScriptContext.CreateEvent()
        objEvent.EventSource = strEventSource
        objEvent.EventNumber = intEventNumber
        objEvent.EventType = intEventType
        objEvent.Message = strEventMessage
        ScriptContext.Submit objEvent
    End Sub

     

    You only have to parameterize these values (strPath, strDrive, strThreshold ) to make this script generic.

     

    Regards

     

    Huib

    Friday, April 18, 2008 11:06 AM
  •  

    I have a folder size script that writes size data to a custom performance object, as well as a tutorial with an MP you can add the script into. Please read this post, download the bits and let me know if you have trouble.

     

    http://www.systemcenterforum.org/file-and-folder-monitoring-scripts-for-operations-manager-and-essentials-2007/

     

    Sometimes I lose track of these threads, so if you post a question back here and I fail to assist, contact me through the 'Contact Us' page on the above site.

     

    Saturday, April 19, 2008 8:35 PM
  • This doesn't work. It continues to give errors:


    Microsoft VBScript runtime error (34, 7) : Object required: 'ScriptContext'
    Microsoft VBScript runtime error (35, 4) : Object required: 'objEvent'
    Microsoft VBScript runtime error (36, 7) : Object required: 'objEvent'
    Microsoft VBScript runtime error (37, 7) : Object required: 'objEvent'
    Microsoft VBScript runtime error (38, 7) : Object required: 'objEvent'
    Microsoft VBScript runtime error (39, 7) : Object required: 'ScriptContext'

    Sunday, November 29, 2009 1:10 AM
  • Could this work in the same manner as a PowerShell script?
    Friday, July 9, 2010 5:54 PM