Jump to content

turgel

Members
  • Posts

    5
  • Joined

  • Last visited

Reputation Activity

  1. Upvote
    turgel got a reaction from Chris in notification when file size exceeds limit   
    Hi everyone,
    After playing around with the powershell i wrote a small script which does the following:
    1. get the size of a certain folder 
    2. take this result and compare it with a set limit (in this case 7500 Megabytes)
    3. if this limit is exceeded it starts the pulseway notifcation bridge and sends out the notification.
     
    This is very useful to me, i use it to monitor the sql database size of vmware vcenter.
    I will post it here, hopefully it will help someone else:
    ###########################################################
     
    $h = 7500
    $colItems = (Get-ChildItem "C:\THISFOLDER" | Measure-Object -property length -sum)
    "{0:N2}" -f ($colItems.sum / 1MB) + " MB"

    If ($colItems.sum / 1MB -gt $h )

    invoke-item "C:\YOURPULSEWAYFOLDER\NOT.lnk"
    }
     
    ##################################################################
     
    note: I made a link to the notifcationbridge.exe (NOT.lnk) to give to correct commands, writing it out directly in the powershell didn't work for some reason.
×
×
  • Create New...