Setting Disk Quotas for User Profiles on Windows Server

Windows 2000 Server, and I imagine other versions of it, allow you to set disk quotas on an entire drive. You can even set different limits for different users. Unfortunately, you can't set limits on just one folder of a drive.

To create monitoring on a specific folder, I put together a Windows Scripting Host file which will scan each folder and find out the size. If it's larger than the quota amount then it'll send out an e-mail to a support address. It can also set the folder to read-only access.

At work, we've set this up to run on a nightly basis but you can easily set it up to run anytime using Scheduled Tasks.

Two things to note:

  1. The script must be run under a user accout that has access to all subfolders, which is usually the local administrator account. Otherwise, the script will generate an error message that it doesn't have access to a folder.
  2. Since it assumes that it is checking user folders, it expects every subfolder name to be the user account name. If this is not the case, you'll need to modify the script to filter out folders that don't need to be checked.

This script is fairly straightforward. It uses the FileSystemObject to get the directory size, a command-line program called cacls to set the security access on the folder, and finally CDOSYS (aka CDO for Windows 2000) for sending out the support e-mail.

View the script source


Published January 10, 2005 · Updated September 17, 2005
Categorized as Servers
Short URL:


1 Comment · RSS feed
Brian Searle said on March 13, 2005

Thank you for that script.

It works well on our Windows 2003 Server. It was exactly what I needed to flag users' folders to be archived off to CD.

You are a deadset champion!!!

Sorry, comments are closed for this post. If you have any further questions or comments, feel free to send them to me directly.