Problem
You want to create a disk quota on a file server.
Solution
Using a graphical user interface
-
Open the File Server Management MMC snap-in. Navigate to File Server Management
File Server Resource Manager
Quota Management.
-
Right-click on Quotas and select “Create quota.” Under “Quota path,” specify the directory that this quota should apply to or click Browse to navigate to it using Windows Explorer. Select the radio button next to “Create quota on path.”
-
To base the quota on a quota template, select the “Derive properties from this quota template (recommended),” and select the template from the drop-down box. To manually specify a quota, select the “Define custom quota properties” radio button. Click on Custom Properties to define the properties for this quota; the process is similar to the steps used in defining a quota template.
-
Click Create.
Using a command-line interface
The following command will create a 100 MB soft disk quota entry on the D:\ drive:
> dirquota quota add /path:d:\* /limit:100mb /type:soft
Using VBScript
'---------SCRIPT CONFIGURATION------------------------ strComputer = "<ComputerName>" ' Use "." for local computer strDomain = "<DomainDN>" ' e.g. RALLENCORP strUser = "<UsersAMAccountName>" ' e.g. jsmith strDeviceID = "<DriveLetter>" ' e.g. D: '----------------------------------------------------- Set objWMIService = GetObject("winmgmts:" _ & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2" Set objAccount = objWMIService.Get _ ("Win32_Account.Domain=strDomain,Name=strUser") Set objDisk = objWMIService.Get _ ("Win32_LogicalDisk.DeviceID=strDeviceID") Set objQuota = objWMIService.Get _ ("Win32_DiskQuota").SpawnInstance_ objQuota.QuotaVolume = objDisk.Path_.RelPath objQuota.User = objAccount.Path_.RelPath objQuota.Limit = 10485760 objQuota.WarningLimit = 8388608 objQuota.Put_
Discussion
Once you’ve created one or more quota templates, you can specify actual disk quotas that apply to folders that reside on a particular hard drive. It’s a good idea to create quotas based on templates rather than specifying them manually, since this will simplify the administration of your file server. (For example, if you need to change a quota template after it is initially created, you can specify that those template changes should be automatically propagated to any quotas that are based on that template.) Otherwise you can create a quota manually, specifying the same information as is required when creating a quota template.