#52592 - 2000-12-06 03:34 PM
Re: GetDiskSpace Only Works The 2nd Time?
|
Anonymous
Anonymous
Unregistered
|
Hallas, Great script, the only thing I might suggest is to put the server names into a different file so adding servers will be easy.This is a script I wrote a while back, it outputs drive space to the screen and warns when the space is too low. I just had it run in my login script. It reads in file with server names and drives to check. DriveSpace.kix
code:
$ServerNames="C:\WINNT\Profiles\mpearce\Desktop\scripts\servers.txt" $LowSpace = 600 GOSUB "DrawBack" $XLine = 2 $YLine = 2IF Open(3, "$ServerNames",2) = 0 $ScanLine = ReadLine(3) WHILE @ERROR = 0 ;? "Line read: [" + $x + "]" $CommaPosition=INSTR($ScanLine,",") $ServerName=SUBSTR($ScanLine,1,$CommaPosition -1) $ScanLine=SUBSTR($ScanLine,$CommaPosition+1,LEN($ScanLine)) WHILE $CommaPosition <> 0 $CommaPosition=INSTR($ScanLine,",") IF $CommaPosition = 0 $ServerDrive=$ScanLine ELSE $ServerDrive=SUBSTR($ScanLine,1,$CommaPosition -1) ENDIF GOSUB "ShowDriveInfo" $ScanLine=SUBSTR($ScanLine,$CommaPosition+1,LEN($ScanLine)) LOOP $ScanLine = ReadLine(3) GOSUB "PlusY" LOOP $x = Close (3) ELSE BEEP ? "Config file not opened, error code: [" + @ERROR + "]" Get $x ENDIF goto "end" :ShowDriveInfo
$diskspace=GetDiskSpace( "\\$ServerName\$ServerDrive$$" ) $dsmb = $diskspace /1024 IF $dsmb < 300 Color +r/b ENDIF AT ($YLine,$XLine) "\\$ServerName\$ServerDrive$$" $dsmb = " $dsmb" $dsmb = SUBSTR($dsmb, LEN($dsmb) - 4, 5) AT ($YLine,$XLine + 20) "$dsmb MB" GOSUB "PlusY" Color +y/b return :drawback small CLS color b+/b BOX (0,0,23,79,SINGLE) color y+/b AT (0,47) " " + @DAY + ", " + @MONTH + " " + @MDAYNO + " " + @YEAR + " " return :PlusY $YLine = $YLine + 1 IF $YLine = 20 IF $XLine = 42 GOSUB "PlusX" ELSE $XLine = 42 $YLine = 2 ENDIF ENDIF return :PlusX Color +g/b AT (23,25) "(Press any key to continue)" Color +y/b get $x GOSUB "Drawback" $XLine = 2 $YLine = 2 return :end GOSUB "PlusX"
Server.txt
code:
SERVER1,C,D,E SERVER2,C,D SERVER3,C,D,E SERVER4,C,D,E SERVER5,C,D,E SERVER6,C,D,E SERVER7,C,D SERVER8,C,D SERVER9,C SERVER10,C,D,E SERVER11,C,D,E,F,G
Mark P.
|
|
Top
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 484 anonymous users online.
|
|
|