abasov
Member | Редактировать | Профиль | Сообщение | ICQ | Цитировать | Сообщить модератору 'Установка квот на группы в домене 'Из ком. строки> script.vbs users c 'Begin Comment ' Force the script to use only defined variables. 'End Comment Option Explicit Dim sUserName, oGroup, sDomain, sDrive, sGroup Dim WshNetwork, colDiskQuotas, oMember, oUser 'Begin Comment ' Print the instructions for the user. 'End Comment If WScript.Arguments.Count <1 Then Call Help 'Begin Comment ' Define the variables. 'End Comment sGroup = WScript.Arguments(0) sDrive = WScript.Arguments(1) If WScript.Arguments.Count >2 Then sGroup = WScript.Arguments(0) & " "& WScript.Arguments(1) sDrive = WScript.Arguments(2) end if 'BEGIN CALLOUT A Set WshNetwork = WScript.CreateObject("WScript.Network") sDomain = WshNetwork.UserDomain 'END CALLOUT A 'Begin Comment ' Create a quota collection and initialize its connection ' to the selected drive. 'End Comment Set colDiskQuotas = CreateObject("Microsoft.DiskQuota.1") 'Begin Callout B colDiskQuotas.Initialize sDrive&":\", True 'End Callout B 'Begin Callout C colDiskQuotas.QuotaState = 2 'End Callout C 'Begin Comment ' Connect to the object representing the group. 'End Comment 'msgbox "WinNT://" & sDomain & "/" & sGroup 'Set oGroup = GetObject ("WinNT://" & sDomain & "/" & sGroup &", group") Set oGroup = GetObject ("WinNT://" & sDomain & "/" & sGroup ) 'Begin Comment ' Apply the quota to each member of that group. 'msgbox "End Comment" For each oMember in oGroup.Members ' WScript.Echo oMember.Name sUserName = oMember.Name 'Begin Callout D Set oUser = colDiskQuotas.AddUser(sUserName) 'End Callout D Set oUser = colDiskQuotas.FindUser(sUserName) oUser.QuotaThreshold = 60000000000 oUser.QuotaLimit = 70000000000 Next Sub Help WScript.Echo "Instructions" WScript.Echo "This script sets up disk quotas for a group on" WScript.Echo "a named disk. To run the script, type the name" WScript.Echo "of a group (using quotation marks if its name" WScript.Echo "has more than one word) and the drive letter." WScript.Quit End Sub | Всего записей: 345 | Зарегистр. 12-11-2002 | Отправлено: 08:19 08-12-2006 | Исправлено: abasov, 14:25 08-12-2006 |
|