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:
- 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.
- 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.