Monitor Free Disk Space Information on a Computer

Given a list of computers, this script alerts you when free disk space falls below a specified limit.

Add to favorites
E-mail Twitter Digg Facebook
  • VB Script to get Disk usage and computer description.
    1 Posts | Last post March 19, 2019
    • I have script to get disk information and is working fine. But I have modified to get computer information and it is working as well. however my end results are redundant because of FOR LOOP. Also I have to run this scrip twice as we have two domain. Can someone help me to get rid of redundant information and how can I run script once to get information from both domain?
      On Error Resume Next 
      Const ForAppending = 8 
      Const HARD_DISK = 3 
      Const ForReading = 1 
      Set objFSO = CreateObject("Scripting.FileSystemObject") 
      Set SrvList = objFSO.OpenTextFile("C:\scripts\Disk_Usage\Server_List.txt", ForReading) 
      Dim strBadDisks
      Set WriteFile = objFSO.OpenTextFile("C:\scripts\Disk_Usage\List.txt", ForAppending, True)
      Do Until SrvList.AtEndOfStream 
          StrComputer = SrvList.Readline 
          Set objPing = GetObject("winmgmts:{impersonationLevel=impersonate}")._
             ExecQuery("select * from Win32_PingStatus where address = '"_
             & strComputer & "'")
          For Each objStatus in objPing
             If not IsNull(objStatus.StatusCode) Then
                If objStatus.StatusCode = 0 Then
                   On Error Resume Next
                   Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") 
                   Set colDisks = objWMIService.ExecQuery("Select * from Win32_LogicalDisk Where DriveType = " & HARD_DISK & "") 
                   Set colItems = objWMIService.ExecQuery("Select Description from Win32_OperatingSystem",,48)
                   If Err.Number = 0 Then
      		For Each objItem in colItems
      			For Each objDisk in colDisks 
      				  FrPercent=Round((FrSpace / TotSpace)*100,0)
      UsSpace=Round((TotSpace - FrSpace),2) 
      [SCRIPT END]
  • workstations.txt file details
    2 Posts | Last post February 03, 2015
    • What do you put in the "c:\scripts\workstations.txt" file?
    • The answer is between the "" of your question :)