#118374 - 2004-04-21 12:53 PM
kiX & Disk Quota's???
|
otf
Getting the hang of it
Registered: 2003-11-21
Posts: 53
Loc: Scotland
|
Has anyone written KiX that can read & report disk quota info? what i'd like: user logs in, KiX retrieves user Disk Quota info, KiX sends popup message to user reporting how much space they have taken up on the server, and how much they have left.
I'm using Active Directory I'm not asking one of you guys to write this for me, no-no-no. I'm wondering if it has already been done, or if it is possible to do with KiX.
I know that the Quota info for user's is held in the Security ID (SID), 'if that's any help'! 
many thanks, otf
|
|
Top
|
|
|
|
#118379 - 2004-04-21 05:12 PM
Re: kiX & Disk Quota's???
|
otf
Getting the hang of it
Registered: 2003-11-21
Posts: 53
Loc: Scotland
|
function quotaUser($drive,$user,$type,$set)
dim $guota
if not exist($drive) exit 3 endif
$quota = CreateObject("microsoft.diskquota.1")
if 9<>vartype($quota) exit 120 endif
$quota.initialize($drive,$set)
$quota=$quota.findUser($user)
if @error exit 87 endif
select
case 1=$type $quotauser=$quota.used
case 2=$type $quotauser=$quota.quotalimit
case 3=$type $quotauser=$quota.quotalimittext
case 4=$type $quotauser=$quota.QuotaThreshold
endselect
endfunction
"your quotalimit is " quotauser("U:\",@sid,3,0)
"and you have used " quotauser("U:\",@sid,1,0)
can't seem to find the quota entries.
the U:\ drive i have stated is a mapped drive on \\server\home\%username%
am i missing something here?
Edited by otf (2004-04-21 06:39 PM)
|
|
Top
|
|
|
|
#118380 - 2004-04-21 08:53 PM
Re: kiX & Disk Quota's???
|
Lonkero
KiX Master Guru
   
Registered: 2001-06-05
Posts: 22346
Loc: OK
|
ok, instead just displaying the data, check also the error: "your quotalimit is " quotauser("U:\",@sid,3,0) if @error "uups, error occured - " @error endif "and you have used " quotauser("U:\",@sid,1,0) if @error "uups, error occured - " @error endif
_________________________
!download KiXnet
|
|
Top
|
|
|
|
#118382 - 2004-04-22 12:45 PM
Re: kiX & Disk Quota's???
|
otf
Getting the hang of it
Registered: 2003-11-21
Posts: 53
Loc: Scotland
|
hhmmm. I'm getting error 87 (user not recognised). if i punch in @userid it returns the correct username. i don't understand this.
Function quotaUser($drive,$user,$type,$Set) Dim $quota If NOT Exist($drive) Exit 3 EndIf $quota = CreateObject("microsoft.diskquota.1") If 9<>VarType($quota) Exit 120 EndIf $quota.initialize($drive,$Set) $quota=$quota.findUser($user) If @error Exit 87 EndIf Select Case 1=$type $quotauser=$quota.used Case 2=$type $quotauser=$quota.quotalimit Case 3=$type $quotauser=$quota.quotalimittext Case 4=$type $quotauser=$quota.QuotaThreshold EndSelect EndFunction
"your quotalimit is " quotaUser("U:\",@USERID,3,0) If @error "ERROR occured - " @error EndIf "and you have used " quotaUser("U:\",@USERID,1,0) If @error "ERROR occured - " @error EndIf
also, as this looks at the drive space, what if the user has saved files elsewhere on the server disk (which will account to the user's disk quota, but will not add to the user's total mapped disk size).
|
|
Top
|
|
|
|
#118384 - 2004-04-22 04:55 PM
Re: kiX & Disk Quota's???
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
There is a typo in the udf Code:
dim $guota
should be Code:
dim $quota
However, this shouldn't cause problems with the script unless you are using the variable $quota outside of the UDF.
I am also unable to get this to work for me. I am running it on a WinXP Pro computer and have tried it against a network drive and a local drive without success, but each type returns a different error. When checking against a network drive it fails on this line... Code:
$quota.initialize($drive,$set)
with the following error: COM exception error "INITIALIZE" ((null) - (null)) [-2147352567/80020009]
When I check against "c:\" it fails here... Code:
$quota=$quota.finduser($user)
with the following error: Incorrect function.
Any thoughts?
-Ben http://www.rgcweb.org/kix
|
|
Top
|
|
|
|
#118385 - 2004-04-22 05:26 PM
Re: kiX & Disk Quota's???
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
After working with the UDF some, it appears to work on the local computer. It breaks pretty good when going to a network drive/share though.
-Ben http://www.rgcweb.org/kix
|
|
Top
|
|
|
|
#118386 - 2004-04-22 07:02 PM
Re: kiX & Disk Quota's???
|
Bonji
Starting to like KiXtart
Registered: 2001-09-28
Posts: 169
Loc: Virginia
|
I found another little problem with the UDF. Replace Code:
case 1=$type $quotauser=$quota.used
with Code:
case 1=$type $quotauser=$quota.quotaused
-Ben http://www.rgcweb.org/kix
|
|
Top
|
|
|
|
#118387 - 2004-04-22 10:50 PM
Re: kiX & Disk Quota's???
|
Allen
KiX Supporter
   
Registered: 2003-04-19
Posts: 4563
Loc: USA
|
Hey Ben, I'm a Roanoker too... glad to see there is someone else around here who has an appreciation for kixtart.
|
|
Top
|
|
|
|
#118389 - 2004-04-23 10:55 AM
Re: kiX & Disk Quota's???
|
otf
Getting the hang of it
Registered: 2003-11-21
Posts: 53
Loc: Scotland
|
ok, ignore my last post, if i can get it to work with the user's mapped U:\ drive, i'll be happy.
i appear to get an error at : $quota=$quota.findUser($user)
still getting booted out with an 87
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 883 anonymous users online.
|
|
|