Disk Quota Script

Posted on 2011-04-20
Last Modified: 2012-05-11
Hi there,

I would like to create a script that will change the disk quota entry for specific users. The users that the script will change will be located in a csv file that will be created every day.

So the workflow is this:

Each day a CSV file is created from a database that contains a list of usernames that need to have their disk quota entry modified. (This can be done already, I don't need help with this part)

The script will then run after the file is created and take each username in that CSV file, and modify their disk quota entry to a specific number, in our case 2 GB.

Any ideas?

Question by:dfranciscus
    LVL 12

    Expert Comment

    On Remote computer?

    For Domain users?

    Can you also post Sample input csv file?


    Author Comment

    Yep for domain users, the script can run on that server that has the quota, so not remotely. The sample CSV will likely be the user account line by line:



    LVL 12

    Accepted Solution

    Try the following code...

    You are required to mention the drive ("C:\")
    On Error Resume Next
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objTextFile = objFSO.OpenTextFile(input_file, 1)
    Set colDiskQuotas = CreateObject("Microsoft.DiskQuota.1")
    colDiskQuotas.Initialize "C:\", True
    Do Until objTextFile.AtEndOfStream
        Set objUser = colDiskQuotas.FindUser(uname)
        objUser.QuotaLimit = 2147483648

    Open in new window


    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
    The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
    This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
    This tutorial will walk an individual through the steps necessary to install and configure the Windows Server Backup Utility. Directly connect an external storage device such as a USB drive, or CD\DVD burner: If the device is a USB drive, ensure i…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    19 Experts available now in Live!

    Get 1:1 Help Now