Managing Disk Quotas

Posted: March 28, 2010 in Active Directory, Server, System Information
Tags: ,

Problem

You want to create a disk quota on a file server.

Solution

Using a graphical user interface
  1. Open the File Server Management MMC snap-in. Navigate to File Server Management File Server Resource Manager Quota Management.

  2. 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.”

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

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

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s