WinQuota home
WinQuota 4.5 - disk quota management software
Key features (full list)
limit the maximal size of each file or directory
set up different limit values for different users
set up different limit values for different groups
serve any existing user or group credentials from domains
WinQuota quota management tool
WinQuota - disk quota utility download Buy WinQuota now
  • 1 year support of all present features
  • free updates and bug fixes
  • no limitations by processor
    Action! $199/server
  • WinQuota - disk quota utility download Download trial (2,2 MB)
  • $0
  • limited support
  • limited functionality when trial period expires
  • Batch quota management

    Back to Index

    Setting limits from text files

    WinQuota has couple of examples how to manage quota limits through VB Scripts; the typical example is

        set api = CreateObject("WinQuota.API.2")
        set item = api.createEmptyItem
    ' Filling with specific data we need
        item.account = "Anyone" ' <- here you need actual domain group/user name
        item.hardLimit = 10240 ' 10 MB; all values are operated in kilobytes.
        item.softLimit = 10240 ' 10 MB; se hardLimit64 if you need exact values in bytes
    ' Applying an limit
        api.addQuotaItem "c:\test", item
    

    So you can extend this easy by adding few lines to read such textual file with settings and apply limits through this script.

    The script below uses the text file with the following structure (comma is separator):

           full path to quota, account, quota size in kilobytes, optional email
    

    To let this script clear we're not added handling of spaces, wrong file structure, etc to keep it as clear as it possible, so there is good starting point to make your own scripts.

    const ForReading = 1
    dim objFS, objTS, line
    dim array, path, account, quota, email
    dim api, item
    set api = CreateObject("WinQuota.API.2")
    set objFS = CreateObject("Scripting.FileSystemObject")
    set objTS = objFS.OpenTextFile("myfile.txt"), ForReading)
    while not objTS.AtEndOfStream
      line = objTS.ReadLine
      array = Split(line, ",")
      path = array(0)
      account = array(1)
      quota = cint(array(2))
    ' setting quota
      set item = api.createEmptyItem
      item.account = account
      item.hardLimit = quota
      item.softLimit = quota
      api.addQuotaItem path, item
    wend
    objTS.Close
    

    With the following script, you can specify email notifications against the same text file:

    const ForReading = 1
    dim objFS, objTS, line
    dim array, path, account, quota, email
    Dim objArgs
    Set objArgs = WScript.Arguments
    ' objArgs(0) - directory
    ' objArgs(1) - user name
    ' objArgs(2) - occupied size
    dim Body
    Body = "WinQuota soft quota limit exceeded: " & vbCr & _
            "Directory = " & objArgs(0) & vbCr & _
            "User      = " & objArgs(1) & vbCr & _
            "Size      = " & objArgs(2) & " bytes" & vbCr
    set objFS = CreateObject("Scripting.FileSystemObject")
    set objTS = objFS.OpenTextFile("myfile.txt"), ForReading)
    while not objTS.AtEndOfStream
      line = objTS.ReadLine
      array = Split(line, ",")
      path = array(0)
      account = array(1)
      email = array(3)
      if (instr(objArgs(0), path) = 1) and not (email = "") then
         Set objMessage = CreateObject("CDO.Message")
         objMessage.Subject = "WinQuota Alert"
         objMessage.Sender = "robot@winquota.com"
         objMessage.To = email
         objMessage.TextBody = Body
         objMessage.Send
      end if
    wend
    objTS.Close
    

    Note: 2nd script needs to be configured as notification script through UI or through WinQuota API' "addNotification" function. Notification options can be vary; but please use account with permissions enough to send emails and with access to our text file for read.

    Back to Index

    Home - Technologies - WinQuota - WinArmor - WinJail - Site Map - Services - Support
        Copyright © WinQuota LLC, 2004-2018. All Rights Reserved.