home *** CD-ROM | disk | FTP | other *** search
/ PC Pro 2005 July / DPPCPRO0705.ISO / Extras / NetHelpDesk / _SETUP.1 / wmiDiscSpaceCheck.vbs < prev    next >
Encoding:
Text File  |  2002-11-17  |  841 b   |  31 lines

  1. ' This script checks that the amount of free space on c: drive is 250mb.
  2. ' It could check other discs too.  Version 1.1
  3.  
  4.  
  5. Dim WshSHell
  6. set WshShell = CreateObject("WScript.Shell")
  7.  
  8. dim s1,s2
  9. dim fs1
  10.  
  11. for each Disk in GetObject("winmgmts:").InstancesOf ("CIM_LogicalDisk")
  12.  d=disk.deviceid 
  13.  
  14.  if d="C:" then
  15.   fs=Disk.freeSPace
  16.   fs=fs / (1024 * 1024)
  17.  
  18.   fs1=round(fs,0)
  19.   s1="SERVER1-C-has-" & fs1 & "-mb-free"
  20.  
  21. '  wscript.echo s1
  22.  
  23.   if fs<250 then   
  24.      WshShell.Run("NetHDSendStatus service=00004 status=FAULT smtpserver=localhost smtprecipient=helpdesk@cnetis.co.uk subject=SERVICESTATUS message=DiscSpaceProblem")
  25.   else
  26.      WshShell.Run("NetHDSendStatus service=00004 status=OK smtpserver=localhost smtprecipient=helpdesk@cnetis.co.uk subject=SERVICESTATUS message=DiscSpaceOK")
  27.   end if
  28.  end if 
  29.  
  30. next
  31.