Page 1 of 1 1
Topic Options
#32942 - 2002-11-20 06:05 AM getdiskspace at login script
Anonymous
Unregistered


hi all,
very long time no post...

i am trying to get 'getdiskspace' to work at login for all students.
however, the number that is returned doesn't make sense.[in the script the number '645310' is what i got returned for a 15.04Mb homedrive]

if students' homedrive > 15mb then warn them and eventually stop access to their homedrive.

i have tried using 3rd party commandline utils to get a dirtotal, but they're too slow or not 'pipeable' into a script.
i've also mucked around with 'diruse' but can't get it to work.

at the moment i just scan users' drives at the end of the day and put a token file in. that triggers a response from the kix login script and deals with it accordingly.
but that is not automatic detection, which is what i'm trying to work out.

this is part of the script
code:
 
;
$udrive=GetDiskSpace("\\server_6\zztop$\")
SELECT
CASE $udrive < 645310 AND exist ("\\server_6\zztop$\m1")
del "\\server_6\zztop$\m1"
CASE $udrive < 645310 AND exist ("\\server_6\zztop$\m2")
del "\\server_6\zztop$\m2"
CASE $udrive > 645310 AND exist ("\\server_6\zztop$\m2")
messagebox ("Your U: drive total size is larger than 15Mb"
+chr(10)+" "
+chr(10)+"It is $udrive big"
+chr(10)+"You no longer have access to your U: drive"
+chr(10)+" "
+chr(10)+" "
+chr(10)+"To regain access to your U: drive"
+chr(10)+" Please contact Mr. Bouman","Access DENIED" ,16)
use u: /delete
CASE $udrive > 645310 AND exist ("\\server_6\zztop$\m1")
messagebox ("Your U: drive total size is larger than 15Mb"
+chr(10)+"This is your last warning"
+chr(10)+" "
+chr(10)+"You WILL be denied access if you "
+chr(10)+"fail to reduce your U: drive","CTS network notice" ,32)
+chr(10)+" "
+chr(10)+"If you need help deleting files, please see Mr. Bouman today."
del "\\server_6\zztop$\m1"
copy "\\server_6\netlogon\m2" "\\server_6\zztop$\m2"
CASE $udrive > 645310
messagebox ("Your U: drive total size is larger than 15Mb"
+chr(10)+"Please delete files to reduce the size of"
+chr(10)+"your U: drive. "
+chr(10)+" "
+chr(10)+"See Mr Bouman if you need special"
+chr(10)+"consideration, eg; If you are working"
+chr(10)+"on a big project."
+chr(10)+" "
+chr(10)+"Otherwise you WILL be denied access if you "
+chr(10)+"fail to reduce your U: drive after the 2nd notice","CTS network notice" ,32)
+chr(10)+" "
+chr(10)+"If you want to delete files now, please see Mr. Bouman today."
copy "\\server_6\netlogon\m1" "\\server_6\zztop$\m1"

ENDSELECT

i'm very much obliged for your kind replies.

Top
#32943 - 2002-11-20 06:16 AM Re: getdiskspace at login script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
eh, so you mean that the user can't see more than that 15M?
if you logon as user and query the disksize, it says 15M?
what os?

I wonder why it shows it as 64M...
_________________________
!

download KiXnet

Top
#32944 - 2002-11-20 06:19 AM Re: getdiskspace at login script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Actually it is showing 660797440 bytes.

645310 * 1024 = 660797440

I tested this against my local hard drive.

The user can apparently see 660Meg. free on the disk.
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32945 - 2002-11-20 06:22 AM Re: getdiskspace at login script
Anonymous
Unregistered


the script is supposed to query the size of the users homedrive, if the files total more than 15Mb then notify the user.
clients: win98se
server: nt4
kixtart: 4.12

Top
#32946 - 2002-11-20 06:23 AM Re: getdiskspace at login script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
660?
I took calculator and sure, I did remove one number.
anyway, it's 630M
_________________________
!

download KiXnet

Top
#32947 - 2002-11-20 06:24 AM Re: getdiskspace at login script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
there is the problem that it shows the free disk space user sees... ie available disk space.
_________________________
!

download KiXnet

Top
#32948 - 2002-11-20 06:25 AM Re: getdiskspace at login script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
checking the manual yields
quote:
GetDiskSpace( )

Action: Returns the number of kilobytes (KB) available to the current user on a specific drive.

Lonkero, how did you 630?

1KB = 1024 bytes

[ 20. November 2002, 06:26: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32949 - 2002-11-20 06:28 AM Re: getdiskspace at login script
Anonymous
Unregistered


so it looks as if getdiskspace is reporting on total free space on partition rather than the [mapped] homedrive.
not much space left eh ;-)

whether i run the script as part of the login script or by itself [ on the win9x desktop], the number returned for a user's homedrive is the same. How can i force 'getdiskspace' to report only for the mapped homedrive? is it possible? and would that be fast?

thank you for your fast replies.

Top
#32950 - 2002-11-20 06:29 AM Re: getdiskspace at login script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
See DirSize.exe at http://mywebpages.comcast.net/habullock/Perlutilities.htm
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32951 - 2002-11-20 06:31 AM Re: getdiskspace at login script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
How are you limiting the size of the directory? Quotas? Who's?
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32952 - 2002-11-20 06:35 AM Re: getdiskspace at login script
Anonymous
Unregistered


hhmm, not getting any output from dirsize.exe when run from commandline as 'dirsize c:\temp'
but it's real fast ...
i assume 'recommended run locally' means running the exe from the workstation?

Top
#32953 - 2002-11-20 06:37 AM Re: getdiskspace at login script
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Well, I may be wrong (I'm not going to whip out the manual right now) , but I think the drive has to be MAPPED first. Don't think you can do a GETDISKSPACE against a UNC which is what the code is trying to do it looks like.

Map the drive to a valid letter first, then check the space. However, you will find that it is NOT the users space you will see, but the entire volume which is shared with other users or folders. KiXtart has no built in tools that I'm aware of to check that {quickly}. You can probably put together a script from UDFs that will add up all the files (in fact Howard Bullock) has DirHog on his website that could be used in a script to derive that information.

Top
#32954 - 2002-11-20 06:37 AM Re: getdiskspace at login script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Run on the computer where the physical disk exists not across the network.

C:\Data\Scripts>dirsize C:\Data\Scripts
Elapsed time: 20 seconds
Dirs: 31, Files: 8863, Bytes: 137021155
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32955 - 2002-11-20 06:38 AM Re: getdiskspace at login script
Anonymous
Unregistered


i'm not using quota's or anything. would really like the script to be able to give some basic 'quota' like functionality.
Top
#32956 - 2002-11-20 06:41 AM Re: getdiskspace at login script
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Hey DOC, hows that program working for you now?

[ 20. November 2002, 06:42: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#32957 - 2002-11-20 06:45 AM Re: getdiskspace at login script
NTDOC Administrator Online   content
Administrator
*****

Registered: 2000-07-28
Posts: 11634
Loc: Space
Worked just fine for my purposes. Management was wanting to know where some of the big data hogs were. It worked fine for me.

We have recently though bouth Storage Resource Manager from WQuinn that should hopefully help us control all that pretty easy once we get it all setup.

Top
#32958 - 2002-11-20 07:11 AM Re: getdiskspace at login script
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
just a btw, checked earlier the manual (as happen to have it open in another ie window)

yes, it works on unc. you just need to append the last backslash.
meaning, if you want to check \\PDC\c$, you need to query for \\PDC\c$\
_________________________
!

download KiXnet

Top
#32959 - 2002-11-21 05:13 AM Re: getdiskspace at login script
Anonymous
Unregistered


hhmm, i already found it'll work with unc's. haven't tried dirhog yet.thanks to everyone for their contribs. i'll be back soonish.
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 1471 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.068 seconds in which 0.026 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