Configure disk quota for a user (VBScript)
This code can be found in
Chapter 7 of Windows XP Cookbook
Purchase XP Cookbook or Networking Recipes for only $25 plus shipping! While supplies last.
Find out how to download all of the VBScript code from this site.
' From the book, "Windows XP Cookbook"
' ISBN: 0596007256
' ------ SCRIPT CONFIGURATION ------
strComputer = "."
strUser = "<User>" ' e.g. rallen
strUserDomain = "<Domain>" ' e.g. AMER
strDrive = "<Drive>" ' e.g. D:
intLimit = 1024 * 1024 * 600 ' = 600 MB
intWarning = 1024 * 1024 * 350 ' = 350 MB
' ------ END CONFIGURATION ---------
set objWMI = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
set objDisk = objWMI.Get("Win32_LogicalDisk.DeviceID='" & strDrive & "'")
WScript.Echo "Found disk " & objDisk.Caption
set objUser = objWMI.Get("Win32_Account.Domain='" & strUserDomain & _
"',Name='" & strUser & "'")
WScript.Echo "Found user " & objUser.Name
set objQuota = objWMI.Get("Win32_DiskQuota.QuotaVolume=" & _
"'Win32_LogicalDisk.DeviceID=""" & strDrive & """'," & _
"User='Win32_Account.Domain=""" & strUserDomain & _
""",Name=""" & strUser & """'")
objQuota.Limit = intLimit
objQuota.WarningLimit = intWarning
objQuota.Put_
WScript.Echo "Set quota for user " & objUser.Name
|
This code has been viewed 1236 times.
|
New from the creators of TechTasks.com:
StatSheet.com
|