ProblemYou want to configure disk quota limits for a particular user. SolutionUsing a graphical user interface
Using a command-line interfaceThe following command configures a quota for a particular user: > fsutil quota modify <Drive> <WarningBytes> <LimitBytes> <Domain\User> The following example sets a quota for user AMER\rallen with a ~381 MB warning and ~476 MB limit: > fsutil quota modify d: 400000000 500000000 AMER\rallen Using VBScript' This code configures a quota for a particular user. ' ------ SCRIPT CONFIGURATION ------ strComputer = "." strUser = "<User>" ' e.g. rallen strUserDomain = "<Domain>" ' e.g. AMER strDrive = "<Drive>" ' e.g. D: intLimit = 1024 * 1024 * 600 ' = 600 MB intWarning = 1024 * 1024 * 350 ' = 350 MB ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set objDisk = objWMI.Get("Win32_LogicalDisk.DeviceID='" & strDrive & "'") WScript.Echo "Found disk " & objDisk.Caption set objUser = objWMI.Get("Win32_Account.Domain='" & strUserDomain & _ "',Name='" & strUser & "'") WScript.Echo "Found user " & objUser.Name set objQuota = objWMI.Get("Win32_DiskQuota.QuotaVolume=" & _ "'Win32_LogicalDisk.Device" & strDrive & """'," & _ "User='Win32_Account.Domain=""" & strUserDomain & _ """,Name=""" & strUser & """'") objQuota.Limit = intLimit objQuota.WarningLimit = intWarning objQuota.Put_ WScript.Echo "Set quota for user " & objUser.Name DiscussionIf you decide that you want to delete a quota entry for a particular user, perhaps because you don't want to limit that user anymore, you have to first reassign ownership of all files owned by the user on the volume. Since quota usage is entirely determined by file ownership, you can't have files on a quota-enabled volume that belong to a user that doesn't have a quota entry. You must take ownership of the files yourself, move the files to another volume, or permanently delete the files before deleting the quota entry.
See AlsoRecipe 7.15 for enabling disk quotas; MS KB 183322, "How to Enable Disk Quotas in Windows 2000," MS KB 307984, "HOW TO: Create Disk Quota Reports in Windows XP," and MS KB 308664, "How To Export and Import Disk Quota Settings to Other Volumes in Windows XP" |