Hi!I think I have solved it!!
I have rewriten the FindLargeFolders funktion, af´ter ALOT of thinking
( "mum, my head hurts...."
)
Now I have a quota-management at login for my users.
This is what I have done:
******************************************
;This is a rewrite of "Maarten's"
;"FindLargeFolders" function.
;
;
;
Function QuotaControl($path, optional $minimum,optional $indent)
dim $minsize,$subsize,$folder,$sub,$subs,$_indent,$Total
if vartype ($indent) = 8
$_indent = $indent
endif
$fso = createobject (Scripting.FileSystemObject)
if vartype($minimum) = 3
$minsize = $minimum
endif
$folder = $fso.getfolder($path)
$subs = $folder.subfolders
$_indent = $_indent + " "
for each $sub in $subs
if $sub.size
$subsize = (val($sub.size)) / 955000
$Total=$Total + $subsize
endif
FindLargeFolders($sub,$minsize,$_indent)
next
if (val($Total)) > (val($MinSize))
$Quota = "1"
$Quota_koll=$Total
else
$Quota = "0"
$Quota_koll=$Total
endif
Endfunction
return
********************************************
I have saved this as "Quota.udf"
In my main script i have this:
********************************************
;Call the "Quota"-function
Call (@LSERVER + "\Kix$\Quota.udf")
;Set users maximumsize in H:\ (Mb)
$QuotaSize=50
;Set a varning level for the users (Mb)
$Quotavarning=45
USE H: (@LSERVER + "\" + @USERID + "$")
QuotaControl("H:\",$QuotaSize)
IF Quota_koll > $Quotavarning
cls
? " Warning!! Warning!!"
? " "
? " You have now used $Quotavarning Mb of your space."
? " Remember that if you use more than $QuotaSize Mb,"
? " you will NOT be alowed to login"
Sleep 5
ENDIF
IF $Quota > 0
messagebox("You have use to much diskspace!, The computer will restart now.","@FULLNAME",16,5)
SHELL "%windir%\RUNDLL32.EXE user.exe,ExitWindows"
ENDIF
*******************************************
It seems to be working...
(I haven't put it to a "stress-test" yet)
What do you think??