Page 1 of 1 1
Topic Options
#57912 - 2001-08-03 10:07 AM How to run a script immediately on remote NT4-computer?
Anonymous
Unregistered


Hi

I want to run Kix-script on my machine which asks a remote computer's name. Then it copies another kix-script to it's temp-dir (\\<computer>\c$\Temp) that should be executed immediately.

Using AT-commands I can make it to be executed for example when target's local time is 12:00. I just wonder how to execute it without giving any time-parameters?

Thanks!

Top
#57913 - 2001-08-03 10:35 AM Re: How to run a script immediately on remote NT4-computer?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wellcome on board,
how's the weather in nääsville?

what you need is remotecmd (from reskit)installed if you want to run remotely the script.

the running is then simple as:
shell "command_syntax"

just looked your other post and seems that system account is enough for you. then you might do also the following:

code:

shell "%comspec% /c net time \\$machine > %temp%\$machine"
$ = open(1,"%temp%\$machine")
$time = readline(1)
$ = close(1)
$time = substr($time,1,2)+":"+(val(substr($time,4,2))+2)
shell "%comspec% /c AT \\$machine $time /interactive C:\Temp\Script.cmd"

this way script is run in one to two minutes.

[ 03 August 2001: Message edited by: Lonkero ]

_________________________
!

download KiXnet

Top
#57914 - 2001-08-03 10:45 AM Re: How to run a script immediately on remote NT4-computer?
Anonymous
Unregistered


It's a lovely day here in "manse", very shiny. Friday.. hmm.. beer..

I have NT4-reskit installed, but I can't find Remotecmd.exe anywhere.. Was it reskit for NT4 wks/server or Win2k Pro/Server?

Top
#57915 - 2001-08-03 10:52 AM Re: How to run a script immediately on remote NT4-computer?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
wrong name maybe... in win2k it's remote.exe
_________________________
!

download KiXnet

Top
#57916 - 2001-08-03 11:01 AM Re: How to run a script immediately on remote NT4-computer?
Anonymous
Unregistered


OK, I found that remote.exe in my reskit too (NT4 wks reskit). Thanks for the code, mate! I'll try to modify my scripts and test how it works.
Top
#57917 - 2001-08-04 12:28 AM Re: How to run a script immediately on remote NT4-computer?
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Lonkero, Kaljakone,

careful with that line:

$time = substr($time,1,2)+":"+(val(substr($time,4,2))+2)

what if it's 12:59 ?

check out this : Time plus 2

(still didn't found out the '16 Cases of Novastar' )

Jochen

_________________________



Top
#57918 - 2001-08-04 12:52 AM Re: How to run a script immediately on remote NT4-computer?
Anonymous
Unregistered


Yes, you're right jpols! I noticed that and modified my script.
code:

shell "%comspec% /c net time \\$computer > %temp%\$computer"
$ = open(1,"%temp%\$computer")
$time = readline(1)
? "$time"
?
$ = close(1)

$minutes = Val(SubStr($time,Len($time)-1,2))+2
If $minutes < 10
$minutes = "0" + $minutes
EndIf

$time = substr($time,Len($time)-4,2)+":"+$minutes
shell "%comspec% /c AT \\$computer $time /interactive C:\Temp\Script.cmd"


Now it works!

Top
#57919 - 2001-08-03 01:39 PM Re: How to run a script immediately on remote NT4-computer?
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Kaljakone,

to be on the safe side (Case 12:59 + 2 shouldn't be 12:61) try this :

code:

break on cls
shell "%comspec% /c net time \\$computer > %temp%\$computer"
$ = open(1,"%temp%\$computer")
$time = readline(1)
? "$time"
?
$ = close(1)
$hrs = val(substr($time,1,2)
$minutes = val(substr($time,Len($time)-1,2))
select
case $minutes = 58
$hrs = $hrs + 1
if $hrs = 24 $time = "00:00" else $time = "$hrs:00" endif
case $minutes = 59
$hrs = $hrs + 1
if $h = 24 $time = "00:01" else $time = "$hrs:01" endif
case 1
$minutes = $minutes + 2
if $minutes < 10 $minutes = "0" + $m endif
$time = $hrs + ":" + $minutes
endselect
shell "%comspec% /c AT \\$computer $time /interactive C:\Temp\Script.cmd"


Jochen

_________________________



Top
#57920 - 2001-08-03 01:43 PM Re: How to run a script immediately on remote NT4-computer?
Anonymous
Unregistered


Thanks jpols, am I stupid or what
Top
#57921 - 2001-08-03 01:44 PM Re: How to run a script immediately on remote NT4-computer?
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
hmm... again quicker. I was just replying, when my bbchecker informed me that jpols has allready replied.
well, important is that error was fixed and I know that my script works

cheers,

ps. and kaljakone too. nice script I have...

_________________________
!

download KiXnet

Top
#57922 - 2001-08-03 01:48 PM Re: How to run a script immediately on remote NT4-computer?
Jochen Administrator Offline
KiX Supporter
*****

Registered: 2000-03-17
Posts: 6380
Loc: Stuttgart, Germany
Yeah,
that's the only important thing : No buggy code shall be leaving this board !

Hey, I'll give your bbchecker a shot !

c'ya

J.

_________________________



Top
#57923 - 2002-08-07 03:51 PM Re: How to run a script immediately on remote NT4-computer?
Bxn Offline
Getting the hang of it

Registered: 2002-06-05
Posts: 63
Loc: Alpha Centauri
Unfortunately The 'Net Time' Command In My Environment returns :
quote:
L'heure en cours sur \\MyServer Est 8/7/2002 3:10 PM
So I Wrote these modifications to Handle H12/H24 Format and Garbage Text In Temp. TimeFile and would be glad to read any comment :
code:
$Computer = "Fill With Your Target Computer's Name"

; The Following Line Is The RealTime Command (UnComment when Really Implementing Routine) :
;Shell "%comspec% /c net time \\$computer > %temp%\$computer"

; Use The Following Line For Tests to Limits (Delete when Really Implementing Routine) :
Shell "%comspec% /c Echo Damn'd String Used As Test 2:58 PM > %temp%\$computer"

$Dummy = Open(1,"%temp%\$computer")
If $Dummy = 0

$LineRead = Ucase(Rtrim(Ltrim(ReadLine(1))))
? "Line Read In Temp. TimeFile : " + $LineRead + " [Transformed]"

$Dummy = Close(1)
If $Dummy = 0

$SeparatorPosition = InStr($LineRead,":")

If $SeparatorPosition > 0

$Hours = Val(SubStr($LineRead,$SeparatorPosition-2,2))
? "Hours Raw Value Extraction : " + "$Hours" + " [Type : " + VarType($Hours) + "]"

If SubStr($LineRead,Len($LineRead)-1,2) = "PM" AND $Hours < 12
; I Test $Hours < 12 'cause I've Seen '22:30 PM'
; returned By 'At + CR' Command in my Console ...
? "AM / PM Determination : PM"
$Hours = $Hours + 12
? "AM / PM Determination : PM"
? "New Value In H24 Format : " + "$Hours" + " [Type : " + VarType($Hours) + "]"
Else
? "AM / PM Determination : AM, Or H24 Format"
? "Value Of Hours UnChanged : " + "$Hours" + " [Type : " + VarType($Hours) + "]"
EndIf

$minutes = Val(SubStr($LineRead,$SeparatorPosition+1,2))
? "Minutes Raw Value Extraction: " + "$Minutes" + " [Type : " + VarType($Minutes) + "]"

Select
Case $minutes = 58
$Hours = $Hours + 1
If $Hours = 24
$Time = "00:00"
Else
$Time = "$Hours" + ":00"
EndIf
Case $minutes = 59
$Hours = $Hours + 1
If $Hours = 24
$Time = "00:01"
Else
$Time = "$Hours" + ":01"
EndIf
Case 1
$minutes = $minutes + 2
If $minutes < 10
$minutes = "0" + $minutes
EndIf
$Time = "$Hours" + ":" + "$minutes"
EndSelect

? "Final Result (H24 / Txt) : " + "$Time" + " [Type : " + VarType($Time) + "]"

Else

? "No ':' Time Separator Found ..."

EndIf
Else
? "Can't Close TempTimeFile ..."
EndIf
Else
? "Can't Open TempTimeFile ..."
EndIf

;Shell "%comspec% /c AT \\$computer $Time /interactive C:\Temp\Script.cmd"



Top
Page 1 of 1 1


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

Who's Online
0 registered and 293 anonymous users online.
Newest Members
Sir_Barrington, batdk82, StuTheCoder, M_Moore, BeeEm
17886 Registered Users

Generated in 0.044 seconds in which 0.018 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