[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 929
  • Last Modified:

Disk Quota Script

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?

Thanks!
0
dfranciscus
Asked:
dfranciscus
  • 2
1 Solution
 
prashanthdCommented:
On Remote computer?

For Domain users?

Can you also post Sample input csv file?

regards
Prashanth
0
 
dfranciscusAuthor Commented:
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:

jroberts
ahenry
fyoung

etc.

Thanks!
0
 
prashanthdCommented:
Try the following code...

You are required to mention the drive ("C:\")
input_file="c:\list.txt"

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
    
    uname=Trim(objtextfile.ReadLine)
    Set objUser = colDiskQuotas.FindUser(uname)
    objUser.QuotaLimit = 2147483648
    
Loop

Open in new window

0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now