GFI
English Deutsch Français Italiano Nederlands Español
Forums  Register  Login  My Profile  Inbox  Address Book  My Subscription  My Forums 

Member List  Search  FAQ  Ticket List  Log Out

 

UNC Path Free Space Check

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [Network Security] >> GFI Network Server Monitor >> UNC Path Free Space Check Page: [1]
Login
Message << Older Topic   Newer Topic >>
UNC Path Free Space Check - 8.Jul.2008 2:13:08 AM   
MRIS

 

Posts: 2
Joined: 8.Jul.2008
Status: offline
Here is my community contribution that performs a freespace check on a UNC path.

Hopefully somebody will find this useful, especially for checking free disk space on things like NAS units.

' /////////////////////////////////////////////////////////////////////////////
' Accepts 2 parameters
' First parameter is the UNC path as a string, eg "\\server\path"
' Second parameter is the number of MB to check
' the check reports success of MB free is above this number 
'
' /////////////////////////////////////////////////////////////////////////////

Option Explicit

' Note: A Monitor function can return True, False or Unknown
' True and False are already defined by Visual Basic Engine
' Define the Unknown return value. This value can be any value > 0

Const retvalUnknown = 1


Function UNCpathDiskSpace(ThePath,Size)

 ' This file designed, created, tested and deployed by MRIS

  On Error Resume Next


  Dim fso, d, s, freespace
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set d = fso.GetDrive(fso.GetDriveName(ThePath))
  s = "Drive " & ThePath & " - " 
  s = s & d.VolumeName   & " - "
  s = s & "Free Space: " & FormatNumber(d.FreeSpace/1048576, 0) 
  s = s & " MB"
  freespace = d.FreeSpace/1048576   
  

  If freespace >= Size then 
      EXPLANATION = s & " > " & FormatNumber(Size,0) & " MB"
      UNCpathDiskSpace = True
  End If

  If freespace < Size then 
      EXPLANATION = s & " < " & FormatNumber(Size,0) & " MB"
      UNCpathDiskSpace = False
  End If


End Function


< Message edited by MRIS -- 8.Jul.2008 2:24:09 AM >
Post #: 1
Page:   [1]
All Forums >> [Network Security] >> GFI Network Server Monitor >> UNC Path Free Space Check Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


   © 2008. All rights reserved. GFI Software Home Products Download Trials Support Ordering Site Map About Us Contact us
GFI solutions: Exchange anti spam filter - exchange anti virus - isa server - network vulnerability scanner - event log management - USB security software - exchange archiving - fax server software