Page 1 of 1 1
Topic Options
#118374 - 2004-04-21 12:53 PM kiX & Disk Quota's???
otf Offline
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
#118375 - 2004-04-21 02:00 PM Re: kiX & Disk Quota's???
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
Theres many post's about this. IF you do a search im sure you will find out what you are looking for.

Below is some info on GetDiskSpace

GetDiskSpace

Regards

Aaron
_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#118376 - 2004-04-21 02:23 PM Re: kiX & Disk Quota's???
otf Offline
Getting the hang of it

Registered: 2003-11-21
Posts: 53
Loc: Scotland
thanks

so far i've only come up with this, but i'll spend a bit more time this afternoon i think.

$Result = GetDiskSpace( "U:\" )
$Rd = RedirectOutput('@USERID'+'.log')
$Result("kb")
$Rd = RedirectOutput('')
EXIT

not quite what i'm aiming for but getting close!
need to write this to a messagebox instead of redirecting to a log file.

cheers the noo!
------
update!
$Result = GetDiskSpace("U:\")
MessageBox (@USERID+" you have "+ $Result + "KB space left", "Your Storage Space",64)


Edited by otf (2004-04-21 03:48 PM)

Top
#118377 - 2004-04-21 02:58 PM Re: kiX & Disk Quota's???
AzzerShaw Offline
Seasoned Scripter
****

Registered: 2003-02-20
Posts: 510
Loc: Cheltenham, England
More info on messagebox check out this link

MessageBox

Good luck

_________________________
If at first you don't succeed, try again. Then quit. There's no use being a damn fool about it. - W.C Fields

Top
#118378 - 2004-04-21 04:02 PM Re: kiX & Disk Quota's???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
if you look at www.gwspikval.com/jooel/UDF there is indeed udf for this. it's named quotauser()
_________________________
!

download KiXnet

Top
#118379 - 2004-04-21 05:12 PM Re: kiX & Disk Quota's???
otf Offline
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 Administrator Offline
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
#118381 - 2004-04-21 09:04 PM Re: kiX & Disk Quota's???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
oh, the diskquota info btw isn't bound to SIDs in any way.
logonname works just fine.
also, just to make sure, the udf works only with NT5.0 and up and with ME.
_________________________
!

download KiXnet

Top
#118382 - 2004-04-22 12:45 PM Re: kiX & Disk Quota's???
otf Offline
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
#118383 - 2004-04-22 02:00 PM Re: kiX & Disk Quota's???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh?
if you want to see users diskquota on somewhere, you use that somewhere as the drive.
afaik, you can use unc's... (don't remember did I test with them)

so, are you saying this user has user-quota that is devided on multiple physical and logical drives on the server?
_________________________
!

download KiXnet

Top
#118384 - 2004-04-22 04:55 PM Re: kiX & Disk Quota's???
Bonji Offline
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 Offline
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 Offline
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 Administrator Offline
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
#118388 - 2004-04-22 10:50 PM Re: kiX & Disk Quota's???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
k, that was real problem.
thanks for finding it.
weird thing is that it works for some and does not for some...
_________________________
!

download KiXnet

Top
#118389 - 2004-04-23 10:55 AM Re: kiX & Disk Quota's???
otf Offline
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
#118390 - 2004-04-23 01:26 PM Re: kiX & Disk Quota's???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm...
I remember there were some sorta issues with this descriped on MS site...
have not so much time at the moment (over 2PM and I should go to work) but...
if you want to study on your own:
http://msdn.microsoft.com/library/en-us/shellcc/platform/shell/reference/objects/diskquotacontrol/finduser.asp
_________________________
!

download KiXnet

Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 978 anonymous users online.
Newest Members
batdk82, StuTheCoder, M_Moore, BeeEm, min_seow
17885 Registered Users

Generated in 0.069 seconds in which 0.024 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org