Configuring Default Disk Quota Settings
Microsoft® Windows® 2000 Scripting Guide
As circumstances change, you might need to adjust the default quota settings on a volume. For example, you might initially give each user up to 100 MB of storage space on a volume. If your department hires new employees, you might have to lower this quota to ensure that all these additional users can store items on the disk. Alternatively, by purchasing a second file server for user data, you might be able to divide your users between the two servers, thus providing them with additional disk space.
Either way, you can use the DiskQuotaControl to change the default quota values for a volume. In addition to changing the quota and warning levels, you can also specify whether you want to record quota violations in the event log.
When you change the default disk quota settings, these new values apply only to new users; they are not applied to users who already have disk quota entries on the volume. For example, suppose you have a volume with the quota entries shown in Table 10.6.
Table 10.6 Sample Disk Quota Entries
Name |
Quota Limit |
Warning Level |
---|---|---|
KMeyer |
100 MB |
90 MB |
PAckerman |
200 MB |
180 MB |
RWilliams |
400 MB |
350 MB |
If you change the default quota settings to a quota of 50 MB and a warning limit of 40 MB, those values are applied to any new user who saves a file or folder to the column. However, the quota settings for the three users shown in Table 10.6 do not change. The only way to change the quota settings for existing users is to individually bind to each quota entry and then change the value. For more information about this process, see "Modifying a Disk Quota Entry" later in this chapter.
Scripting Steps
Listing 10.11 contains a script that configures disk quota settings on a computer. To carry out this task, the script must perform the following steps:
Create an instance of the DiskQuota1 object.
Use the Initialize method to indicate that the default quota settings are being changed for drive C.
The Initialize method requires the following two parameters:
The drive letter of the drive where the quota settings are being changed (in this case, C).
The value True, indicating that the drive should be initialized for read/write access. By setting this value to False, you can enumerate disk quota settings on the volume but you cannot make any changes (read-only).
Set the value of the DefaultQuotaLimit property to 10,000,000. This limits users to approximately 10 MB of disk space.
Listing 10.11 Configuring Disk Quota Settings
1 2 3 |
|