Dirquota - Automagically Manage File System Quotas

Did you know that Windows Server contains a file system quota component? “Of course”, you will say. It was introduced with Windows 2000 and is completely useless since it only allows for volume-level quotas. That is true, but at the same time, it is nowadays quite irrelevant. With the R2 update to Windows Server 2003 Microsoft finally got it right and introduced the optional component File Server Resource Manager (FSRM). With FSRM, folder-level quotas find their way into the (professional) lives of administrators who do not care for additional third-party filter drivers that are prone to destabilize production servers.

On this note, I could conclude this post. After all, FSRM brings a nice GUI for managing those great folder-level quotas. But what about automation? Scriping? For those of you who like to automate tasks and/or have to support large environments, I want to provide a few examples.

Prerequisites

In order to use FSRM you need either Windows Server 2003 R2 or Server 2008 with the component File Server Resource Manager installed. FSRM can be installed in an unattended setup by adding the following lines to the answer file (usually unattend.txt):

[Components]
SRM = On

Settings Quotas on Home Directories - From the Command Line

On Systems where FSRM is installed the command line utility dirquota.exe can be used to configure quotas. A very common scenario is to assign quotas to home directories. In order to do that you first need to define a template:

dirquota template add /template:"Home 1 GB" /limit:1GB /type:hard

The example above creates a template that, when assigned to a specific folder, hard limits that folder’s size to 1 GB. The template itself is saved under the name of “Home 1 GB” for later usage. You can, of course, create as many templates as you want. The next step is to assign the template to a specific folder. That can be done with the following command:

dirquota quota add /path:"D:\Data\Users\Home\UserA" /sourcetemplate:"Home 1 GB"

The example above adds a quota of 1 GB (defined in the template above) to the home directory of UserA.

Being able to set quotas on single directories is quite nice. It does not help very much with home directories, though. What you need is the ability to tie the template to the home folder’s base directory and have it applied to every sub-folder auto-magically. That is exactly what the next command does:

dirquota autoquota add /path:"D:\Data\Users\Home" /sourcetemplate:"Home 1 GB"

FSRM will now put the quota defined in template “Home 1 GB” on every subdirectory that gets created directly below D:\Data\Users\Home.

Comments

Related Posts

What's Wrong with Group Policy

What's Wrong with Group Policy
Over the years I have worked with Group Policy in many different ways. My experience ranges from helping an enterprise client establish a brand new set of policies for physical PCs and VDI machines to authoring ADM/ADMX/ADML files. Last year I presented and wrote a very detailed analysis of the impact of Group Policy on user logon performance (blog posts). Along the way I learned a lot about the strengths but also about the weaknesses of Group Policy. This article is an account of the latter.
Windows General

Latest Posts

Fast & Silent 5 Watt PC: Minimizing Idle Power Usage

Fast & Silent 5 Watt PC: Minimizing Idle Power Usage
This micro-series explains how to turn the Lenovo ThinkCentre M90t Gen 6 into a smart workstation that consumes only 5 Watts when idle but reaches top Cinebench scores while staying almost imperceptibly silent. In the first post, I showed how to silence the machine by replacing and adding to Lenovo’s CPU cooler. In this second post, I’m listing the exact configuration that achieves the lofty goal of combining minimal idle power consumption with top Cinebench scores.
Hardware

Fast & Silent 5 Watt PC: Lenovo ThinkCentre M90t Modding

Fast & Silent 5 Watt PC: Lenovo ThinkCentre M90t Modding
This micro-series explains how to turn the Lenovo ThinkCentre M90t Gen 6 into a smart workstation that consumes only 5 Watts when idle but reaches top Cinebench scores while staying almost imperceptibly silent. In this first post, I’m showing how to silence the machine by replacing and adding to Lenovo’s CPU cooler. In a second post, I’m listing the exact configuration that achieves the lofty goal of combining minimal idle power consumption with top Cinebench scores.
Hardware