Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to set disk quota for user group
Message
De
12/09/2005 20:04:50
Neil Mc Donald
Cencom Systems P/L
The Sun, Australie
 
 
À
12/09/2005 19:26:00
Neil Mc Donald
Cencom Systems P/L
The Sun, Australie
Information générale
Forum:
Windows
Catégorie:
Autre
Divers
Thread ID:
01048611
Message ID:
01049001
Vues:
18
Hi,
I converted the VB script to VFP, have not tested it, have to go out to breakdown callout at one the clients.
&&Force the script to use only defined variables
Option Explicit
LOCAL sUserName, objGroup, sDomain, sDrive, sGroup, WshNetwork, colDiskQuotas, objMember, objUser 
*Print the instructions for the user
If Wscript.Arguments.Count <1 Then Call Help

*Define the variables
sGroup = Wscript.Arguments(0)
sDrive = Wscript.Arguments(1)
Set WshNetwork = WScript.CreateObject("WScript.Network")
sDomain = WshNetwork.UserDomain

*Create a quota collection and initialize its connection
*to the selected drive
Set colDiskQuotas = CreateObject("Microsoft.DiskQuota.1")
   colDiskQuotas.Initialize sDrive&":\", True
colDiskQuotas.QuotaState = 2

*Connect to the object representing the group
Set objGroup = GetObject _
     ("WinNT://" + sDomain + "/" + sGroup &", group")
*Apply the quota to each member of that group
For each objMember in objGroup.Members
   Wscript.Echo objMember.Name
   sUserName = objMember.Name
    set objUser = colDiskQuotas.AddUser(sUserName)
   set objUser = colDiskQuotas.FindUser(sUserName)
   objUser.QuotaThreshold = 9000000
   objUser.QuotaLimit = 10000000
Next

PROCEDURE Help
Wscript.Echo "Instructions"
      Wscript.Echo "This script sets up disk quotas for a group on a named disk"
      Wscript.Echo  "To run the script, type the name of a group (using quotation marks)"
      Wscript.Echo "if its name has more than one word) and the drive letter."
      Wscript.Quit      
ENDPROC
Regards N Mc Donald
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform