Modifying a Disk Quota Entry

Microsoft® Windows® 2000 Scripting Guide

microsoft windows 2000 scripting guide

« Previous | Next »   

You can also use the DiskQuotaControl object to modify the quotas assigned to an existing user. By binding to the quota entry for a user, you can change both the maximum disk space allocated to that user (QuotaLimit) and the disk space usage that triggers a quota warning (QuotaThreshold).

Scripting Steps

Listing 10.14 contains a script that modifies the disk quota for a user. To carry out this task, the script must perform the following steps:

  1. Create an instance of the DiskQuota1 object.
  2. Use the Initialize method to indicate that the quota entry to be modified is on drive C.

    The Initialize method requires the following two parameters:

    • The drive letter of the drive where the quota resides (in this case, C).
    • The value True, indicating that the drive should be initialized for read/write access. By setting this value to False (read-only), you can enumerate disk quota entries on the volume but you cannot make any changes.
  3. Use the FindUser method to query the quota entry for jsmith from the fabrikam domain.
  4. Set the QuotaThreshold for user jsmith from the fabrikam domain to 90,000,000 bytes, and set the QuotaLimit to 100,000,000 bytes.

Listing 10.14   Modifying a Disk Quota Entry

1 2 3 4 5 
Set colDiskQuotas = CreateObject("Microsoft.DiskQuota.1") colDiskQuotas.Initialize "C:\", True Set objUser = colDiskQuotas.FindUser("fabrikam\jsmith") objUser.QuotaThreshold = 90000000 objUser.QuotaLimit = 100000000

send us your feedback Send us your feedback « Previous | Next »   


Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
Microsoft Windows 2000 Scripting Guide(c) Automating System Administration 2003
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 635

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net