#32942 - 2002-11-20 06:05 AM
getdiskspace at login script
|
Anonymous
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
|
|
|
|
#32944 - 2002-11-20 06:19 AM
Re: getdiskspace at login script
|
Howard Bullock
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.
|
|
Top
|
|
|
|
#32945 - 2002-11-20 06:22 AM
Re: getdiskspace at login script
|
Anonymous
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
|
|
|
|
#32948 - 2002-11-20 06:25 AM
Re: getdiskspace at login script
|
Howard Bullock
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 ]
|
|
Top
|
|
|
|
#32949 - 2002-11-20 06:28 AM
Re: getdiskspace at login script
|
Anonymous
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
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
|
|
Top
|
|
|
|
#32951 - 2002-11-20 06:31 AM
Re: getdiskspace at login script
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
How are you limiting the size of the directory? Quotas? Who's?
|
|
Top
|
|
|
|
#32952 - 2002-11-20 06:35 AM
Re: getdiskspace at login script
|
Anonymous
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
|
|
|
|
#32954 - 2002-11-20 06:37 AM
Re: getdiskspace at login script
|
Howard Bullock
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
|
|
Top
|
|
|
|
#32955 - 2002-11-20 06:38 AM
Re: getdiskspace at login script
|
Anonymous
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
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 ]
|
|
Top
|
|
|
|
#32959 - 2002-11-21 05:13 AM
Re: getdiskspace at login script
|
Anonymous
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
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
0 registered
and 1471 anonymous users online.
|
|
|