#21451 - 2002-05-16 03:51 PM
Re: runnig a .exe on remote server
|
Colin Williamson
Fresh Scripter
Registered: 2002-05-09
Posts: 19
Loc: Sydney
|
les,
here's the lot.
code:
if exist ("%systemdrive%\emran.txt") ?"It's there..." $file = "%systemdrive%\emran.txt" IF Open(1, $file) = 0 $x = ReadLine(1) ;WHILE @ERROR = 0 ? "Line read: [" + $x + "]" ;$x = ReadLine(1) ? "Currentdate: [" + @DATE + "]" ;LOOP Close (1) ELSE BEEP ? "Config file not opened, error code: [" + @ERROR + "]" ENDIF ?"prefunction" $DaysBetween=DateMath(@DATE,-7) ? "DaysBetween=" +$DaysBetween
;if over 90 days run ;endif else ?"not there..." ; $file = "%systemdrive%\emran.txt" $cr = chr(10) + chr(13) $ = open(1,$file,5) if @error = 0 $ = writeline(1,@DATE + $cr) $ = close(1) else ?"Unable to create $file ! - [" + @error + "] : " + @serror" endif
endif
;FUNCTIONS
function DateMath($ExpD1,$ExpD2) ; Author: ScriptLogic Corporation ; if both parameters are dates (yyyy/mm/dd), a positive ; integer indicating the days between the two dates will be returned. ; if the first is a date (yyyy/mm/dd) and the second is an integer ; (number of days), a new date will be returned. ; UDF dependencies: SerialDate, abs select case instr($ExpD1,'/') and instr($ExpD2,'/') ; two date passed - return daysbetween integer $DateMath=serialdate($ExpD1)-serialdate($ExpD2) if $DateMath<0 $DateMath=$DateMath*-1 endif case instr($ExpD1,'/') and 1-instr($ExpD2,'/') ; date and a number passed - return date $ExpD2=0+$ExpD2 $Datemath=serialdate(serialdate($ExpD1)+$ExpD2) case 1 ; incorrect parameters passed endselect endfunction
function SerialDate($ExpD) ; Author: ScriptLogic Corporation ; parameter ($ExpD) must be a date (in the form of yyyy/mm/dd) ; or an integer previously derived by this function. ; if passed a date, it returns an integer. ; If passed an integer, it returns the date. ; Integers can be used for general-purpose math computations on dates ; and then converted back to dates by calling this function again. ; Algorithms were obtained from: http://www.capecod.net/~pbaum/date/date0.htm dim $z,$h,$a,$b,$c,$y,$m,$d if instr($ExpD,'/') ; date passed $y=val(substr($ExpD,1,4)) $m=val(substr($ExpD,6,2)) $d=val(substr($ExpD,9,2)) if $m<3 $m=$m+12 $y=$y-1 endif ; return an integer $SerialDate=$d+(153*$m-457)/5+365*$y+$y/4-$y/100+$y/400-306 else ; integer passed $z=0+$ExpD+306 ; cast numeric $h=100*$z-25 $a=$h/3652425 $b=$a-$a/4 $y=(100*$b+$h)/36525 $c=$b+$z-365*$y-$y/4 $m=(5*$c+456)/153 $d=$c-(153*$m-457)/5 if $m>12 $y=$y+1 $m=$m-12 endif $m=right('0'+$m,2) $d=right('0'+$d,2) ; return a string date $SerialDate=''+$y+'/'+$m+'/'+$d endif endfunction
|
|
Top
|
|
|
|
#21453 - 2002-05-16 04:09 PM
Re: runnig a .exe on remote server
|
Colin Williamson
Fresh Scripter
Registered: 2002-05-09
Posts: 19
Loc: Sydney
|
Les,
it works, Thanks. why?
Colin
it late here in OZ
|
|
Top
|
|
|
|
#21455 - 2002-05-21 11:29 AM
Re: runnig a .exe on remote server
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
We agree with sealeopard to use our kixstrip tool to prevent unnecessary discussions about possible mistypings. An example of output can be:
code:
IF exist ("%systemdrive%\emran.txt") ?"It's there..." $file = "%systemdrive%\emran.txt" IF Open(1, $file) = 0 $x = ReadLine(1) ;WHILE @ERROR = 0 ? "Line read: [" + $x + "]" ;$x = ReadLine(1) ? "Currentdate: [" + @date + "]" ;LOOP Close (1) ELSE BEEP ? "Config file not opened, error code: [" + @error + "]" ENDIF
?"prefunction"
$daysbetween=DateMath(@date,-7)
? "DaysBetween=" +$daysbetween
;if over 90 days run ;endif
ELSE
;($begin) ; ; tue 21-may-2002 09:28:45 (kix 4.10 vs 3.04e) ; ;Informative KIXSTRIP: input=27 output=27 skip=0 ; ;Warning KIXSTRIP: 1 error in block structure. missing statement(s). ; - do:until [0:0] ; - for|each:in|to:step|next [0|0:0|0:0|0] ; - function:endfunction [0:0] ; -ERROR- - if:else:endif [2:2:1]
; - select:case:endselect [0:0:0] ; - while:loop [0:0] ;Warning KIXSTRIP: some lines contains errors or possible errors. ;Informative KIXSTRIP: 2 block_structures found. ;Informative KIXSTRIP: no UDF's found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ; ;($end)
Our call was: kixstrip input.kix output.kix /block_check greetings.
btw: sealeopard, what are you exactly meaning with online? Something like the BBCodeParser, but now with the capabilities of kixstrip.
(TO_DO) [ 24 May 2002, 12:07: Message edited by: MCA ]
|
|
Top
|
|
|
|
#21456 - 2002-05-22 02:50 AM
Re: runnig a .exe on remote server
|
Colin Williamson
Fresh Scripter
Registered: 2002-05-09
Posts: 19
Loc: Sydney
|
MCA, Jens,
Have been using kixstip and debugged my code.
Now have a permissions problem. running MCA's cpu.kix. All users are admin on there machine but the script falls over when trying to create the $cpu_file in the %tmp% directory.
Any ideas?
Colin
|
|
Top
|
|
|
|
#21457 - 2002-05-22 04:11 AM
Re: runnig a .exe on remote server
|
Howard Bullock
KiX Supporter
   
Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
|
Have you verified that the %TMP% / %TEMP% environment variables are defined and actually point to a valid directory? Have you checked the NTFS permissions on the this directory?
|
|
Top
|
|
|
|
#21458 - 2002-05-22 04:31 AM
Re: runnig a .exe on remote server
|
Colin Williamson
Fresh Scripter
Registered: 2002-05-09
Posts: 19
Loc: Sydney
|
Howard,
The enviroment vairables are set and Eveyone has full control.
|
|
Top
|
|
|
|
#21459 - 2002-05-22 01:38 PM
Re: runnig a .exe on remote server
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
It is possible to install CPU.EXE on your server, but you must change the "$cpu_program" value to complete filepath name. In current version CPU.EXE must put in current working directory.
See following part in our script
code:
; --------------------------------------------------------------------------- ; - site defined settings - ; ---------------------------------------------------------------------------
$debug_mode="yes" ; - no/yes - for additional information about checking registry keys - ; - yes = temporary files will not be deleted - $cpu_program="cpu.exe" ; - specifies path of cpu.exe program. - ; - f.e. c:\winnt\cpu.exe or c:\windows\cpu.exe -
; --------------------------------------------------------------------------- ; - - ; ---------------------------------------------------------------------------
greetings.
btw: we will restyle script to catch also CPU.EXE file as element of PATH setting.
(TO_DO) [ 27 May 2002, 11:44: Message edited by: MCA ]
|
|
Top
|
|
|
|
#21460 - 2002-05-23 02:48 AM
Re: runnig a .exe on remote server
|
Colin Williamson
Fresh Scripter
Registered: 2002-05-09
Posts: 19
Loc: Sydney
|
MCA,
My cpu.exe is pointing to
$cpu_progam="@LSERVER\netlogon\cpu.exe"
Colin
|
|
Top
|
|
|
|
#21461 - 2002-05-24 08:27 AM
Re: runnig a .exe on remote server
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
Did you modify it after our suggestion? Yet solved? greetings.
|
|
Top
|
|
|
|
#21462 - 2002-05-24 08:47 AM
Re: runnig a .exe on remote server
|
Colin Williamson
Fresh Scripter
Registered: 2002-05-09
Posts: 19
Loc: Sydney
|
MCA,
got that bit sorted but now am having a script error on the select statement in cpu.kix. works if for me as admin but not for normal users
|
|
Top
|
|
|
|
#21463 - 2002-05-24 09:12 AM
Re: runnig a .exe on remote server
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
Please verifies the permissions on file "@lserver\netlogon\cpu.exe". Please run following script. We have add some debugging code to it. Put output of file c:\kixdebug.log on the board. Please run SET >c:\setenv.txt from a DOS box and put output of file c:\setenv.txt on the board.
code:
CLS COLOR C+/N AT (1,1) " " IF RedirectOutput("c:\kixdebug.log") ENDIF ? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.04e script starting." ? "-" ? "-curdir: "+LCASE(@curdir) ? "-scriptdir: "+LCASE(@scriptdir) IF (instr("-4.1x-","-"+substr(@kix,1,3)+"x-") <> 0) ? "-scriptname: "+LCASE(@scriptname) ENDIF ? "-startdir: "+LCASE(@startdir) ? "-" ? "-userid: "+LCASE(@userid)+"/"+LCASE(@wuserid) ? "-user priv: "+LCASE(@priv) IF (instr("-4.xx-","-"+substr(@kix,1,2)+"xx-") <> 0) ? "-version: inwin="+@inwin+"/dos="+@dos"/productsuite="+@productsuite+"/producttype="+@producttype"/csd="+LTRIM(RTRIM(@csd)) ELSE ? "-version: inwin="+@inwin+"/dos="+@dos ENDIF ? "-" ?"- start-"+@time+"- @error @serror "?
?"- 1-"+@time+"- @error @serror "? ; IF setconsole("hide") ?"- 2-"+@time+"- @error @serror "? ; ENDIF ?"- 3-"+@time+"- @error @serror "? ; ?"- 4-"+@time+"- @error @serror "? ; NT/95 calculates cpu type + processor speed - Kixtart 3.63, 4.00 ?"- 5-"+@time+"- @error @serror "? ; ?"- 6-"+@time+"- @error @serror "? ; (c) scripting@wanadoo.nl - 2001 ?"- 7-"+@time+"- @error @serror "? ; ?"- 8-"+@time+"- @error @serror "? ; vs 1.02 - program ?"- 9-"+@time+"- @error @serror "? ; ?"- 10-"+@time+"- @error @serror "? ; 1.00 (20010525) original version. ?"- 11-"+@time+"- @error @serror "? ; 1.01p (20010525) add - warning message by missing external program ?"- 12-"+@time+"- @error @serror "? ; 1.02p (20011120) add - "windows XP" ?"- 13-"+@time+"- @error @serror "? ; add - suppress SetConsole("hide") ?"- 14-"+@time+"- @error @serror "? ; ?"- 15-"+@time+"- @error @serror "? ; SPECIAL version for F1-4790 ?"- 16-"+@time+"- @error @serror "? ; ?"- 17-"+@time+"- @error @serror "? ; external programs: cpu.exe ?"- 18-"+@time+"- @error @serror "? ; ?"- 19-"+@time+"- @error @serror "? $prgrm_version="1.02" ?"- 20-"+@time+"- @error @serror "? ; ?"- 21-"+@time+"- @error @serror "? $tmp_directory=ExpandEnvironmentVars("%tmp%") ?"- 22-"+@time+"- @error @serror "? IF (substr($tmp_directory,len($tmp_directory),1) = "\") ?"- 23-"+@time+"- @error @serror "? $tmp_directory=substr($tmp_directory,len($tmp_directory)-1) ?"- 24-"+@time+"- @error @serror "? ENDIF ?"- 25-"+@time+"- @error @serror "? $cpu_file=$tmp_directory+"\kix-cpu.tmp" ?"- 26-"+@time+"- @error @serror "? ; ?"- 27-"+@time+"- @error @serror "? IF (@inwin = 1) ?"- 28-"+@time+"- @error @serror "? $nt_mode="yes" ?"- 29-"+@time+"- @error @serror "? ELSE ?"- 30-"+@time+"- @error @serror "? $nt_mode="no" ?"- 31-"+@time+"- @error @serror "? ENDIF ?"- 32-"+@time+"- @error @serror "? ?"- 33-"+@time+"- @error @serror "? ; --------------------------------------------------------------------------- ?"- 34-"+@time+"- @error @serror "? ; - site defined settings - ?"- 35-"+@time+"- @error @serror "? ; --------------------------------------------------------------------------- ?"- 36-"+@time+"- @error @serror "? ?"- 37-"+@time+"- @error @serror "? $debug_mode="yes" ; - no/yes - for additional information about checking registry keys - ?"- 38-"+@time+"- @error @serror "? ; - yes = temporary files will not be deleted - ?"- 39-"+@time+"- @error @serror "? $cpu_program="@lserver\netlogon\cpu.exe" ? ? "$$cpu_program = "+$cpu_program ? ?"- 40-"+@time+"- @error @serror "? ; - specifies path of cpu.exe program. - ?"- 41-"+@time+"- @error @serror "? ; - f.e. c:\winnt\cpu.exe or c:\windows\cpu.exe - ?"- 42-"+@time+"- @error @serror "? ?"- 43-"+@time+"- @error @serror "? ; --------------------------------------------------------------------------- ?"- 44-"+@time+"- @error @serror "? ; - - ?"- 45-"+@time+"- @error @serror "? ; --------------------------------------------------------------------------- ?"- 46-"+@time+"- @error @serror "? ?"- 47-"+@time+"- @error @serror "? $os="" ?"- 48-"+@time+"- @error @serror "? $os_dos=@dos ?"- 49-"+@time+"- @error @serror "? SELECT ?"- 50-"+@time+"- @error @serror "? CASE ($nt_mode = "yes") AND ($os_dos = "5.1") ; - Windows XP - ?"- 51-"+@time+"- @error @serror "? $os="XP" ?"- 52-"+@time+"- @error @serror "? CASE ($nt_mode = "yes") AND ($os_dos = "5.0") ; - Windows 2000 - ?"- 53-"+@time+"- @error @serror "? $os="W2K" ?"- 54-"+@time+"- @error @serror "? CASE ($nt_mode = "yes") ; - Windows NT - ?"- 55-"+@time+"- @error @serror "? $os="NT4" ?"- 56-"+@time+"- @error @serror "? CASE ($nt_mode <> "yes") AND ($os_dos = "4.90") ; - Windows ME - ?"- 57-"+@time+"- @error @serror "? $os="ME" ?"- 58-"+@time+"- @error @serror "? CASE ($nt_mode <> "yes") AND ($os_dos = "4.10") ; - Windows 98 - ?"- 59-"+@time+"- @error @serror "? $os="W98" ?"- 60-"+@time+"- @error @serror "? CASE ($nt_mode <> "yes") AND ($os_dos = "4.0") ; - Windows 95 - ?"- 61-"+@time+"- @error @serror "? $os="W95" ?"- 62-"+@time+"- @error @serror "? CASE 1 ?"- 63-"+@time+"- @error @serror "? $os="???" ; - undetermined - ?"- 64-"+@time+"- @error @serror "? ENDSELECT ?"- 65-"+@time+"- @error @serror "? ?"- 66-"+@time+"- @error @serror "? ; - :script_cpu_processor ?"- 67-"+@time+"- @error @serror "? ?"- 68-"+@time+"- @error @serror "? $cpu="??? MHz" ?"- 69-"+@time+"- @error @serror "? $processor="???" ?"- 70-"+@time+"- @error @serror "? ; ?"- 71-"+@time+"- @error @serror "? MD "c:\temp" ?"- 72-"+@time+"- @error @serror "? IF (@error <> 0) ?"- 73-"+@time+"- @error @serror "? ENDIF ?"- 74-"+@time+"- @error @serror "? IF (exist($cpu_program) = 1) ?"- 75-"+@time+"- @error @serror "? ;CPU Type Identifier/C Version 2.07 Copyright(c) 1996-98 by B-coolWare. ?"- 76-"+@time+"- @error @serror "? ;Processor: Intel Pentium Pro (P6), 812MHz ?"- 77-"+@time+"- @error @serror "? ;Math unit: Internal ?"- 78-"+@time+"- @error @serror "? IF (Exist($cpu_file) = 1) ?"- 79-"+@time+"- @error @serror "? DEL $cpu_file ?"- 80-"+@time+"- @error @serror "? ENDIF ?"- 81-"+@time+"- @error @serror "? SHELL "%comspec% /c "+$cpu_program+" >"+$cpu_file ?"- 82-"+@time+"- @error @serror "? IF (Open(9,$cpu_file) = 0) ?"- 83-"+@time+"- @error @serror "? $result=ReadLine(9) ; - skip - ?"- 84-"+@time+"- @error @serror "? $result=ReadLine(9) ?"- 85-"+@time+"- @error @serror "? IF (Len($result) > 3) ?"- 86-"+@time+"- @error @serror "? $cpu=LTRIM(RTRIM(Substr($result,Instr($result,",")+1,Len($result)-Instr($result,",")))) ?"- 87-"+@time+"- @error @serror "? $processor=LTRIM(RTRIM(Substr($result,Instr($result,":")+2,Len($result)-Instr($result,":")-2+1))) ?"- 88-"+@time+"- @error @serror "? ENDIF ?"- 89-"+@time+"- @error @serror "? IF (Close(9) <> 0) ?"- 90-"+@time+"- @error @serror "? ENDIF ?"- 91-"+@time+"- @error @serror "? ENDIF ?"- 92-"+@time+"- @error @serror "? IF (Exist($cpu_file) = 1) ?"- 93-"+@time+"- @error @serror "? IF ($debug_mode <> "yes") ?"- 94-"+@time+"- @error @serror "? DEL $cpu_file ?"- 95-"+@time+"- @error @serror "? ENDIF ?"- 96-"+@time+"- @error @serror "? ENDIF ?"- 97-"+@time+"- @error @serror "? ? "CPU: "+$cpu ?"- 98-"+@time+"- @error @serror "? ? " "+$processor ?"- 99-"+@time+"- @error @serror "? ELSE ?"- 100-"+@time+"- @error @serror "? ? "Abort CPU.KIX: missing program '"+LCASE($cpu_program)+"' for "+UCASE($os)+"." ?"- 101-"+@time+"- @error @serror "? EXIT ?"- 102-"+@time+"- @error @serror "? ENDIF ?"- 103-"+@time+"- @error @serror "? ; ?"- 104-"+@time+"- @error @serror "? ; result: $cpu ?"- 105-"+@time+"- @error @serror "? ; $processor
?"- end-"+@time+"- @error @serror "? ? "-" ? "-"+LCASE(@day)+" "+@date+" "+@time+"- kixtart "+@kix+"/3.04e script ending." ? "-" IF (instr("-4.1x-","-"+substr(@kix,1,3)+"x-") <> 0) ? "-"+@cpu+" ("+@mhz+" Mhz, memory "+MemorySize()+" MB)" ENDIF ? "-" ;($begin) ; ; fri 24-may-2002 09:08:14 (kix 4.10 vs 3.04e) ; ;Informative KIXSTRIP: no errors found (input=105 output=105 skip=0). ; ;Informative KIXSTRIP: 11 block_structures found. ;Informative KIXSTRIP: no UDF's found. ;Informative KIXSTRIP: no labels found. ;Summary KIXSTRIP: BREAK CALL DEBUG DISPLAY ENDFUNCTION EXECUTE EXIT FUNCTION GET GETS GOSUB GOTO OLExxx PLAY QUIT RETURN RUN SHELL SLEEP THEN USE ;Informative KIXSTRIP: 1 EXIT ;Informative KIXSTRIP: 1 SHELL ; ;($end)
greetings.
|
|
Top
|
|
|
|
#21464 - 2002-05-24 11:22 AM
Re: runnig a .exe on remote server
|
Colin Williamson
Fresh Scripter
Registered: 2002-05-09
Posts: 19
Loc: Sydney
|
MCA,
Sorry, going to have to wait until Monday. Too many beer at the pub on a friday
Colin
|
|
Top
|
|
|
|
#21465 - 2002-05-24 11:26 AM
Re: runnig a .exe on remote server
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
Dear,
No problem. A good weekend. greetings.
|
|
Top
|
|
|
|
#21466 - 2002-05-24 02:43 PM
Re: runnig a .exe on remote server
|
Mark Bennett
Getting the hang of it
Registered: 2001-10-10
Posts: 70
|
The Resource Kit utility is called RConsole and should do the trick quite nicely for you.
|
|
Top
|
|
|
|
#21467 - 2002-05-29 05:01 PM
Re: runnig a .exe on remote server
|
MCA
KiX Supporter
   
Registered: 2000-04-28
Posts: 5152
Loc: Netherlands, EU
|
|
|
Top
|
|
|
|
#21469 - 2002-06-04 09:45 AM
Re: runnig a .exe on remote server
|
Colin Williamson
Fresh Scripter
Registered: 2002-05-09
Posts: 19
Loc: Sydney
|
Guys,
Think I finally sorted it. Sorry for the delay, no L haven't been in the pub all this time.
Thanks muchly
|
|
Top
|
|
|
|
Moderator: Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart
|
1 registered
(Allen)
and 271 anonymous users online.
|
|
|