Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
Keeping track of the quota settings on all volumes on a computer is an important administrative task. You need to know whether disk quotas have been enabled, and you need to know both the default quota and the actions the system takes if a user exceeds the quota. This information can be retrieved by using the DiskQuotaControl. Table 10.4 lists a subset of key properties for this object. All of these properties are read/write, meaning that scripts can be used to both configure and enumerate these settings.
Table 10.4 DiskQuotaControl Properties
Property | Description |
---|---|
DefaultQuotaLimit | Default limit (in bytes) set for quotas on this particular volume. If the DefaultQuotaLimit is -1, no quota limit has been set. |
DefaultQuotaThreshold | Default warning limit (in bytes) set for quotas on this particular volume. If the DefaultQuotaThreshold is -1, no warning limit has been set. |
LogQuotaLimit | Indicates whether or not events are written to the event log if users exceed their quotas. |
QuotaState | Level of quota management set for this particular volume. Values are: 0 Quota management is not enabled on this volume. 1 Quotas are enabled on this volume, but are not enforced. Users are allowed to exceed their quota limit. 2 Quotas are tracked and enforced on this volume. Users are not allowed to exceed their quota limit. |
LogQuotaThreshold | Indicates that events are written to the event log when the warning limit is exceeded. |
Listing 10.9 contains a script that enumerates the disk quota settings for drive C on a computer. To carry out this task, the script must perform the following steps:
The Initialize method requires the following two parameters:
Because the quota state is returned as an integer (0 if quotas are disabled, 1 if quotas are enabled but not enforced, and 2 if quotas are enabled and enforced), an If Then construct is used to echo the appropriate message (for example, "Quota state: Disabled" if the value of the QuotaState property is 0).
Listing 10.9 Enumerating Disk Quota Settings
|
|
Send us your feedback | « Previous | Next » |