Finding PCs Running Out of Drive Space


When I was working in the manufacturing realm, we had some older computers that were still alive and kicking. For the most part, they performed their tasks perfectly, except when the 4GB hard disk ran out of space. Unlike our servers, our PCs didn’t have a handy utility that reported incidents like that. However, I still needed to know when a PC was running out of space before the system went down, so I created my own solution, which runs as little code as possible on the PC.

Here’s what I did. First, I added the code in Check_PC_Free_Space.vbs (see Listing 1) to our logon script. When a computer has less than 500MB of free disk space, this code writes the computer’s name, the number of bytes free, and the date to a log file. The log file is in a shared folder on a file server. I typically create a shared folder for tasks like this, giving the folder separate permissions. In this case, I granted the Domain Users and Domain Computers groups write access to the shared folder. If you have nosy users, you can hide the shared folder by adding a dollar sign ($) to the end of its name.

Next, I scheduled a task on the server where the log file resides. The scheduled task runs the Log_File_Update_Check.vbs script every four hours. As Listing 2 shows, this script uses VBScript’s DateDiff function to determine whether the log file has been updated. If it has been updated, the script executes a batch file that emails the log file to me.

Listing 3 shows the batch file, Email_Log_File.bat, which uses Blat to send the email. The email notification is most important part of the solution. Without this notification, it would be easy to forget to review the log file regularly. The email lets you know about the problem within a few hours of it being discovered. Thus, the problem can usually be fixed before a Help desk call is made.

If you want to try this solution, you can download the code in the listings by going to the top of the page and click Download the Code Here button. You’ll also need to download Blat if you don’t already have it. Blat is great for emailing notifications and various types of files and is pretty simple to use.

Hide comments


  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.