REM ***** Change the two lines below to refect your disk quota drive ****** REM ***** and your AD Domain Name strDrive = "D:" strDomain = "KHSW.local" REM ***** Change the following line to the location of the text file containing ****** REM ***** the list of users to set the disk quota on ***** strUserList = "D:\userlist.txt" REM ***** Set the value below to the amount of quota you wish to assign to each user ***** REM ***** e.g. If a user has used 120Mb and the value below is 50Mb then the user ***** REM ***** will have a quota of 170Mb ***** strAddQuota = 50 REM ******************************************************************************* REM **************** DO NOT CHANGE ANYTHING BELOW THIS LINE *********************** REM ******************************************************************************* REM ***** This will run it on the local computer ***** strComputer = "." REM ***** Open the list of usernames ***** Set fs = CreateObject("Scripting.FileSystemObject") Set file = fs.OpenTextFile(strUserList,1,False) REM ***** Loop for every username in text file ***** Do Until file.AtEndOfStream REM ***** Read in next username ***** strUser = file.Readline REM ***** Connect to user in AD ***** Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set objQuota = objWMIService.Get _ ("Win32_DiskQuota.QuotaVolume='Win32_LogicalDisk.DeviceID=" & chr(34) & strDrive & chr(34) & "'," & _ "User='Win32_Account.Domain=" & chr(34) & strDomain & chr(34) & _ ",Name=" & chr(34) & strUser & chr(34) & "'") REM ***** Convert AddQuota to bytes ***** strAddQuota = strAddQuota * 1000000 REM ***** Debug lines - enable for msgbox displaying quota to be set ***** 'WScript.Echo (int((objQuota.DiskSpaceUsed + strAddQuota)/1048576)) * 1048576 'WScript.Echo objQuota.WarningLimit REM ***** Set Limit and Warning limit quotas ***** REM ***** The devide and times statements ensure whole values will appear in the quota list ***** REM ***** Otherwise you will have fractions of Mb which looks messy in the quota list ***** objQuota.Limit = (int((objQuota.DiskSpaceUsed + strAddQuota)/1048576)) * 1048576 objQuota.WarningLimit = (int((objQuota.DiskSpaceUsed + strAddQuota - 10000000)/1048576)) * 1048576 REM ***** Save the quota values against the user ***** objQuota.Put_ REM ***** Move onto next user ***** loop REM ***** Close username file ***** file.close REM ***** Display messagebox when complete ***** WScript.Echo "Done!"