3.17. Viewing Disk Quota Usage

Problem

You want to view the quota usage for one or more users.

Solution

Using a graphical user interface

  1. Open Windows Explorer.

  2. Browse to the drive on which you want to enable quotas, right-click it, and select Properties.

  3. Click the Quota tab.

  4. If quotas are enabled, click the Quota Entries button. If quotas are not enabled, enable them as described in Recipe 3.15.

  5. The Quota Entries application contains a listing of all users that have quotas configured along with their quota limit, warning limit, and amount used. You can sort this screen by selecting View Arrange Items from the menu and choosing one of the options to sort by.

Using a command-line interface

Use the following command to view the quota usage for all users on drive D:

> fsutil quota query d:

Use the following command to search the event log for all users that are violating their quota:

> fsutil quota violations

Tip

Before using the violations options of fsutil, be sure that you've enabled event logging of warning and limit errors (see Recipe 3.15).

Using VBScript

' This code displays the quota usage for users on a particular drive.
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
strDrive = "<Drive>" ' e.g., D: ' ------ END CONFIGURATION --------- set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") set colQuotas = objWMI.ExecQuery("select * from Win32_DiskQuota " & _ "where QuotaVolume = 'Win32_LogicalDisk.DeviceID=""" & strDrive & """'") for each objQuota in colQuotas WScript.Echo ...

Get Windows Server Cookbook now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.