Using the Quota Management Console to administer disk quotas is definitely your first choice but there are instances when you may need to automate some admin tasks and would therefore need a command that can be used in scripts or in small applications. The dirqouta command-line tool allows you to configure disk quotas from a command prompt or a script. However, before you start playing around with dirquota you need to make sure that the Quota Management role is installed and running.
Go to Server Manager and check that Quota Management node exists under Roles\File Services\Share and Storage Management\File Server Resource Manager/ and if not follow these steps:
Right click Roles\File Services and select Add Role Services as shown below:
From the Add Role Services windows check the File Server Resource Manager checkbox and click Next
Complete the wizard steps and note that you may need to exit and load back Server manager to see the new File Server Resource Manager service. Now, back to dirquota command:
To add a new directory quota on the shared folder C:\Data that would not allow users to exceed 50MB type:
dirquota quota add /Path:C:\Data /Limit:50MB /Type:Hard
Where the option /Type:Hard defines that the threshold cannot be exceeded, otherwise set Type to Soft.
Although you can create many different quotas with different options such as, notifications, it is far easier to create templates and use Dirquota to apply these templates. For example, the following command applies the standard inbuilt template – 200 MB Limit Reports to User, to the C:\data folder:
dirquota quota add /Path:C:\Data /SourceTemplate:"200 MB Limit Reports to User"
For complete usage information, type the command dirquota /?