HOW TO: Use the Disk Quota Management Script (Diskquotasettings.pl) in Windows 2000 (320047)



The information in this article applies to:

  • Microsoft Windows 2000 Server
  • Microsoft Windows 2000 Advanced Server
  • Microsoft Windows 2000 Professional

This article was previously published under Q320047

SUMMARY

This step-by-step article describes how to use the Disk Quota Management Script tool (Diskquotasettings.pl) to configure disk quotas for NTFS file system volumes of local and remote Windows 2000-based computers.

Diskquotasettings.pl is available in Windows 2000 Resource Kit Supplement 1. You can use Diskquotasettings.pl to perform the following disk quota management tasks on NTFS volumes of computers that are running Windows 2000:
  • Turn on disk quotas by using the default settings.
  • Turn off disk quotas.
  • Change disk quota settings. You can set default disk quota limits and warning levels, enforce disk quota limits, and generate events if limits and warning levels are reached.
  • Display disk quota settings.
Diskquotasettings.pl configures and displays settings that correspond to the information on the Quota tab of the NTFS volume properties. To view this information in Microsoft Windows Explorer, right-click the volume, click Properties, and then click the Quota tab.

IMPORTANT: Do not use Diskquotasettings.pl if you use Group Policy to enforce disk quota settings. Diskquotasettings.pl can violate disk quota policies in which the following Group Policy settings may become ineffective:
  • Enable disk quotas
  • Enforce disk quota limit
  • Default quota limit and warning level
  • Log event when quota limit exceeded
  • Log event when quota warning level exceeded
NOTE: To manage disk quotas of NTFS volumes on remote computers, you must first map the root folder of the remote volume to a drive letter on the local computer.

back to the top

System Requirements for Diskquotasettings.pl

Diskquotasettings.pl runs on a source computer and acts on a target computer (which can be the same computer or a different computer than the source computer). Before you can use this script tool to display or configure disk quotas of volumes on local and remote computers, your system configuration must meet certain requirements. The following sections describe the requirements to use Diskquotasettings.pl.

back to the top

Source Computer

  • The computer is running either Windows 2000 Professional or Windows 2000 Server.
  • ActiveState ActivePerl Build 521 is installed. This program is available in the Windows 2000 Resource Kit.

    The computer must also be correctly configured to run the Perl scripts that are included in Windows 2000 Resource Kit Supplement 1. The Resource Kit WMI provider module, Wmi.pm, must be in the Perl Installation Folder\Site\Lib\W2rk folder. The Resource Kit Setup program typically creates the W2rk folder and copies the Wmi.pm file to this folder.

    If the W2rk folder is not automatically created during Setup, you can manually create it and configure the environment in which you want to run Diskquotasettings.pl. For more information about how to configure the environment, see the Troubleshooting section later in this article.
  • You use a user account that is a member of the Administrators group of the target computer to log on.
back to the top

Target Computer

  • The computer is running either Windows 2000 Professional or Windows 2000 Server.
  • The computer contains volumes formatted with NTFS.
back to the top

Overview of Diskquotasettings.pl

Diskquotasettings.pl uses the following general syntax, where -operation is one of the following commands that you can pass to the script:

diskquotasettings.pl -operation

The following list describes each operation that you can use with Diskquotasettings.pl:

-enable: Use this operation to enable disk quotas.
-disable: Use this operation to disable disk quotas.
-change: Use this operation to change disk quota settings.
-query: Use this operation to display disk quota settings.

Each operation uses its own syntax. The following sections describe the syntax for the Diskquotasettings.pl operations.

back to the top

Enable

The diskquotasettings.pl -enable statement uses the following syntax:

diskquotasettings.pl -enable drive_letter: [ drive_letter:...] | *

You can use the following parameters that with diskquotasettings.pl -enable :
  • drive_letter: [ drive_letter:...]| *: Use this parameter to specify the volumes on which you want to enable the disk quota management feature. If you want to turn on disk quota management for two or more volumes, separate each "drive_letter:" entry with a space. If you want to turn on disk quota management on all NTFS volumes on the computer or mapped to the computer, use the wildcard character (*).

    NOTE: The first time that you turn on disk quota management on a volume, the default disk quota management settings are used. Thereafter, when you turn on disk quota management, the last settings that are used for the volume are automatically applied again. You can modify these settings by using the -change operation. For more information about how to do so, see the Change section later in this article.
back to the top

Disable

The diskquotasettings.pl -disable statement uses the following syntax:

diskquotasettings.pl -disable drive_letter: [ drive_letter:...] | *

You can use the following parameters with diskquotasettings.pl -disable :
  • drive_letter: [ drive_letter:...]| *: Use this parameter to specify the volumes on which you want to disable the disk quota management feature. If you want to turn off disk quota management for two or more volumes, separate each drive_letter: with a space. If you want to turn off disk quota management on all NTFS volumes on or mapped to the computer, use the wildcard character (*).

    NOTE: When you turn off disk quota management on a volume, disk quota settings are disabled for the volume but the values are saved. The next time you turn on disk quota management on the volume, those settings are automatically reapplied.
back to the top

Change

The diskquotasettings.pl -change statement uses the following syntax:

diskquotasettings.pl -change drive_letter: [ drive_letter:...] | * [ -setlimit integer_unit | nolimit] [ -setwarn integer_unit | nolimit] [ -deny yes | no ][ -loglimit yes | no ][ -logwarn yes | no ]

You can use the following parameters with diskquotasettings.pl -change:
  • drive_letter: [ drive_letter:...]| *: Use this parameter to specify the volumes whose disk quota settings you want to change. If you want to specify two or more volumes, separate each "drive_letter:" entry with a space. If you want to apply the changes to all NTFS volumes on the computer or mapped to the computer, use the wildcard character (*).
  • -setlimit nteger_unit | nolimit: Use this parameter to specify a new default disk quota limit. The disk quota limit must be greater than or equal to the disk quota warning level. You can use the following variables with -setlimit:
    • integer_unit represents a whole number followed by one of the following units without a space: KB, MB, GB, TB, PB. For example, 5MB, or 3500KB.
    • nolimit indicates that although disk use is tracked, it is not limited on this volume.
  • -setwarn integer_unit | nolimit: Use this parameter to specify a new default disk quota warning level. The warning level must be less than or equal to the disk quota limit. You can use the following variables with -setwarn:
    • integer_unit represents a whole number followed by one of the following units without a space: KB, MB, GB, TB, PB. For example, 4MB, or 2500KB.
    • nolimit indicates that no warnings are generated. You can use this variable only when the disk quota limit (-setlimit) is set to nolimit.
  • -deny yes | no: Use this parameter to specify whether users can exceed their disk quota limit. You can use the following variables with -deny:
    • yes: Use this variable to deny additional disk space if a user exceeds their disk quota limit.
    • no: Use this variable to permit additional disk space when a user exceeds their disk quota limit. Users can continue to write to the volume as long as physical disk space is available.
  • -loglimit yes | no: Use this parameter to specify whether an event is recorded in the Application log of Event Viewer when a user exceeds their disk quota limit.
  • -logwarn yes | no: Use this parameter to specify whether an event is recorded in the Application log of Event Viewer when a user exceeds their disk quota warning level.
NOTES:
  • The -deny, -loglimit, and -logwarn settings apply to all users of the volume including users that have disk quota entries that set custom disk quota limits and warning levels.
  • The disk quota limit and warning level settings determine default values for new users of the volume. If you want to establish exceptions to these default settings for individual users, right-click the volume in Windows Explorer, click Properties, click the Quota tab, and then click Quota Entries.
back to the top

Query

The diskquotasettings.pl -query statement uses the following syntax:

diskquotasettings.pl -query drive_letter: [ drive_letter:...] | *[ -format csv | list | table]

You can use the following parameters with diskquotasettings.pl -query:
  • drive_letter: [ drive_letter:...]| *: Use this parameter to specify the volumes that you want to search. If you want to display disk quota settings of all NTFS volumes on the computer or mapped to the computer, use the wildcard character (*).
  • -format csv | list | table: Use this parameter to specify the output format. If you omit this parameter, Diskquotasettings.pl uses the table format, by default.
back to the top

Examples

  • To turn on disk quota management for all NTFS volumes that are on the local computer or mapped to the local computer, type the following line at the command prompt, and then press ENTER:

    diskquotasettings.pl -enable *

  • To turn off disk quota management on volumes E, F and H, type the following line at the command prompt, and then press ENTER:

    diskquotasettings.pl -disable e: f: h:

  • To change the default disk quota limit on volume G to 750 megabytes (MB) and set the default warning level to 700 MB, type the following line at the command prompt, and then press ENTER:

    diskquotasettings.pl -change g: -setlimit 750MB -setwarn 700MB

  • To display the disk quota settings of all volumes that are on the local computer or mapped to the local computer in list format and redirect the output to a file named Quotas.txt in the C:\Reports folder, type the following line at the command prompt, and then press ENTER:

    diskquotasettings.pl -query * -format list > c:\reports\quotas.txt

  • To display the disk quota settings of volume C of a remote computer using the default table format, type the following line at the command prompt, and then press ENTER:

    diskquotasettings.pl -query z:

    NOTE: In this example, volume C of the remote computer is mapped to volume Z of the local computer.
back to the top

Troubleshooting

If you run Diskquotasettings.pl, you receive the following error message:
ERROR: Wmi.pm is required to run the script.
Copy Wmi.pm from the Resource Kit directory to /Perl/site/lib/W2RK.
This behavior may occur if the computer is not correctly configured to run the Perl scripts that are included in the Windows 2000 Resource Kit Supplement 1. To use Diskquotasettings.pl, the W2rk folder must exist in the Perl Installation Folder\site\lib folder and it must contain the Wmi.pmi file.

To resolve this behavior, manually configure the environment in which to run Perl scripts:
  1. Create a folder named W2rk in the Perl Installation Folder\Site\Lib folder.

    NOTE: The default Perl Installation Folder is drive:\Perl, where drive is the drive on which Windows is installed.
  2. Copy the Wmi.pmi file from the folder in which the Windows 2000 Resource Kit is installed (by default, this folder is Program Files\Resource Kit) to the W2rk folder that you created in step 1.
If you right-click a volume in Windows Explorer, and then click Properties, the Quota tab is not displayed in the Properties dialog box. You can only use the disk quota management feature with volumes that are formatted with NTFS. In addition, the currently logged-on user must be a member of the Administrators group on the computer on which the volume resides. If either of these conditions is not met, the Quota tab is not displayed.

back to the top

REFERENCES

For additional information about how to manage disk quotas in Windows 2000, click the article numbers below to view the articles in the Microsoft Knowledge Base:

183322 How to Enable Disk Quotas in Windows 2000

300979 HOW TO: Manage Disk Capacity and Usage By Using Windows 2000

228812 Disk Quota Events Not Written to the Event Log Immediately

For more information about the Windows 2000 Resource Kit and the Windows 2000 Resource Kit Supplement 1, visit the following Microsoft Web site: back to the top

Modification Type:MajorLast Reviewed:9/27/2006
Keywords:kbhowto kbHOWTOmaster KB320047 kbAudITPro