Microsoft® Windows® 2000 Scripting Guide
« Previous | Next »
The DiskQuotaControl enables you to enumerate the quota entries for a particular volume. You can use this object to determine the quota and warning limit established for each user, the amount of disk space currently charged to the user, and whether the user has exceeded his or her quota level. Key user-related properties of the DiskQuotaControl are shown in Table 10.7.
Table 10.7 DiskQuotaControl Properties Related to Individual Users
Property | Description |
---|---|
AccountStatus | Status of the user account. Values are: 0 Account is valid. 1 Account information is unavailable. 2 Account has been deleted. 3 Account is invalid. 4 Account cannot be found. 5 Account information cannot be resolved. |
DisplayName | Full name of the user associated with the quota entry (for example, Ken Myer). Values will be displayed only for local user accounts. |
ID | Unique ID number assigned to the quota entry. |
LogonName | User name of the user associated with the quota entry (for example, kmyer). |
QuotaLimit | Quota limit (in bytes) set for this particular user. A value of -1 means that no limit has been set for the user. |
QuotaThreshold | Warning limit (in bytes) set for this particular user. A value of -1 means that no limit has been set for the user. |
QuotaUsed | Current number of bytes currently in use by this particular user. |
Listing 10.12 contains a script that enumerates the disk quota entries on a computer. To carry out this task, the script must perform the following steps:
The Initialize method requires the following two parameters:
Listing 10.12 Enumerating Disk Quotas
|
|
When a user reaches his or her quota warning level, an event is recorded in the System event log on the computer where the quota violation occurred. However, no notice of any kind is issued to the user. Users do not know that they are reaching their quota limit unless an administrator periodically scans the event log for quota violations and then issues a warning. Without such notices, users will find out they have reached their quota limit only when they attempt to save a file and are denied access because they have run out of disk space.
Because of this, you might want to create a script that periodically checks to see which users, if any, are over their warning limit and then issues an alert (such as an e-mail message).
Send us your feedback | « Previous | Next » |