#57912 - 2001-08-03 10:07 AM
How to run a script immediately on remote NT4-computer?
|
Anonymous
Anonymous
Unregistered
|
HiI 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
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
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
|
|
|
|
#57916 - 2001-08-03 11:01 AM
Re: How to run a script immediately on remote NT4-computer?
|
Anonymous
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
|
|
|
|
#57918 - 2001-08-04 12:52 AM
Re: How to run a script immediately on remote NT4-computer?
|
Anonymous
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
|
|
|
|
#57920 - 2001-08-03 01:43 PM
Re: How to run a script immediately on remote NT4-computer?
|
Anonymous
Anonymous
Unregistered
|
Thanks jpols, am I stupid or what
|
|
Top
|
|
|
|
#57923 - 2002-08-07 03:51 PM
Re: How to run a script immediately on remote NT4-computer?
|
Bxn
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
|
|
|
|
Moderator: Glenn Barnas, NTDOC, Arend_, Jochen, Radimus, Allen, ShaneEP, Ruud van Velsen, Mart
|
0 registered
and 302 anonymous users online.
|
|
|