Page 1 of 3 123>
Topic Options
#21430 - 2002-05-09 10:15 AM runnig a .exe on remote server
Colin Williamson Offline
Fresh Scripter

Registered: 2002-05-09
Posts: 19
Loc: Sydney
Hi All, Am pulling my hair out on this one.
Am trying to run an .exe on a remote server as part of the log on script.

have trying using run & shell in various ways to the exe, then tried to run a local .bat but get the internal/extenal command error.

any suggests appriciated

Top
#21431 - 2002-05-09 01:12 PM Re: runnig a .exe on remote server
Mark Bennett Offline
Getting the hang of it

Registered: 2001-10-10
Posts: 70
Assuming these are NT servers you can use a reskit tool that is similar to Netware rconsole. What are you trying to do though?
Top
#21432 - 2002-05-09 01:52 PM Re: runnig a .exe on remote server
Kdyer Offline
KiX Supporter
*****

Registered: 2001-01-03
Posts: 6241
Loc: Tigard, OR
Colin,

Welcome to the board!

Can you show the bit of code that is giving you troubles? There maybe switches, etc. that are needed?

For example, here is how we are checking for WMI being installed on a system:

code:
 ;INSTALL WINDOWS MANAGEMENT INSTRUMENTATION
:wmi
;CHECK TO SEE IF THE FOLDER EXISTS
$wbempath="%WINDIR%\SYSTEM32\WBEM\."
;CHECK TO SEE IF THE FOLDER EXISTS
IF 1 <> Exist("$WBEMPATH")
RUN @ldrive+"Programs\wmint4.exe /s"
RETURN
ELSE
RETURN
ENDIF

HTH,

- Kent
_________________________
Utilize these resources:
UDFs (Full List)
KiXtart FAQ & How to's

Top
#21433 - 2002-05-09 03:39 PM Re: runnig a .exe on remote server
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
It sounds like a permissions problem. Get it to work this way:

1. Share the proper location. -- \\server\share\filetorun.exe

2. Set permissions on the share folder (doublecheck to see if you can execute file outside logon script from remote PC under proper userid as well) to allow executable access for whoever is running the logon script (domain\everyone?)

3. execute from the logon script with:

SHELL "\\server\share\filetorun.exe" or
SHELL "%comspec% /c \\server\share\filetorun.exe > nul"

Brian

Top
#21434 - 2002-05-09 04:27 PM Re: runnig a .exe on remote server
Sealeopard Offline
KiX Master
*****

Registered: 2001-04-25
Posts: 11165
Loc: Boston, MA, USA
Question:

Are you trying to execute an executable on a local machine that resides on a remote machine?

OR

Are you trying to execute an executable on a remote machine that resides on the remote machine?
_________________________
There are two types of vessels, submarines and targets.

Top
#21435 - 2002-05-10 02:58 AM Re: runnig a .exe on remote server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Big difference between ON or FROM. Like Jens asked, ON the remote server or FROM the remote server?

If you are trying to run something from a remote server, the full UNC path and filename should do it. Whether or not the command interpreter is needed depends on the program you are trying to run and/or whether you are trying to pipe or redirect. See also the FAQ, (almost) everything you wanted to know about RUN and SHELL

[ 10 May 2002, 03:00: Message edited by: LLigetfa ]
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21436 - 2002-05-10 02:42 PM Re: runnig a .exe on remote server
Colin Williamson Offline
Fresh Scripter

Registered: 2002-05-09
Posts: 19
Loc: Sydney
I clarify, run the .exe in tokyo from the remote server in singapore

tried RUN '\\server\share\.exe' but it falls over.
probably due to the WAN delay.

did get the script ot run a local .bat, finally, which executes the remote .exe. I'd rather just run the .exe

Top
#21437 - 2002-05-10 03:36 PM Re: runnig a .exe on remote server
BrianTX Offline
Korg Regular

Registered: 2002-04-01
Posts: 895
Hmm... well if a delay is causing the problem, then you might want to look into copying the file locally (perhaps to your %temp% folder -- assuming it exists), and executing it from there.

Brian

Top
#21438 - 2002-05-14 05:42 AM Re: runnig a .exe on remote server
Colin Williamson Offline
Fresh Scripter

Registered: 2002-05-09
Posts: 19
Loc: Sydney
Brian, can't copy to the local machine as the .exe requires other files on the share to log info of the client.

My next question is does anyone have any code i can use to, long winded. check for a file in the root dir, if not there create and write the date, then do a run. if the file exists, read the date and if over 90 days do a run otherwise skip.

Thanks

Colin

Top
#21439 - 2002-05-14 06:05 AM Re: runnig a .exe on remote server
Howard Bullock Offline
KiX Supporter
*****

Registered: 2000-09-15
Posts: 5809
Loc: Harrisburg, PA USA
Break your requested functionality down into individual steps and starting reading the manual.

1. if Exist()
2. Create what? See Open, Writeline, WriteProfileString, etc.
3. See RUN and SHELL. You may want to start your program from a batch so that you can change to the remote drive and and directory. It may help in the execution of the file.
4. ELSE to #1
5. endif
Somewhere in there you want a GetFileTime()

[ 14 May 2002, 06:07: Message edited by: Howard Bullock ]
_________________________
Home page: http://www.kixhelp.com/hb/

Top
#21440 - 2002-05-14 06:48 AM Re: runnig a .exe on remote server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You may also want to check out our UDF Library for DateMath stuff.

There are a lot of posts on "file older than" so worth a search.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21441 - 2002-05-15 09:29 AM Re: runnig a .exe on remote server
Colin Williamson Offline
Fresh Scripter

Registered: 2002-05-09
Posts: 19
Loc: Sydney
just found out, half my problem was the version of KIX32 i was trying to run, now have the latest and I can use the open command.

Still plugging along, let you know how it ends up

Top
#21442 - 2002-05-15 10:52 AM Re: runnig a .exe on remote server
Mark Bennett Offline
Getting the hang of it

Registered: 2001-10-10
Posts: 70
What is the EXE you are trying to run? Another option may be to schedule to EXE from your script on the server (at say 1 minute in the future).

Mark

Top
#21443 - 2002-05-16 02:50 PM Re: runnig a .exe on remote server
Colin Williamson Offline
Fresh Scripter

Registered: 2002-05-09
Posts: 19
Loc: Sydney
Les,

Arrrh, tried using the Datemath function but am getting a Script error: expected expression ! Am just testing how it work with the examlpe, $LastWeek=DateMath(@Date,-7)

What am i doing wrong. the functions are at the end of my sript file.

Colin

Top
#21444 - 2002-05-16 02:53 PM Re: runnig a .exe on remote server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
I have to ask...

Are you running KiX4?
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21445 - 2002-05-16 02:57 PM Re: runnig a .exe on remote server
Colin Williamson Offline
Fresh Scripter

Registered: 2002-05-09
Posts: 19
Loc: Sydney
Yep, 4.02, and I have both DateMath and SerialDate functions
Top
#21446 - 2002-05-16 03:14 PM Re: runnig a .exe on remote server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
Colin,
I'd have to see your code. I tried that one line you posted and it works for me.

$LastWeek=DateMath(@Date,-7)
$LastWeek ?

Returns:
2002/05/09
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21447 - 2002-05-16 03:19 PM Re: runnig a .exe on remote server
Colin Williamson Offline
Fresh Scripter

Registered: 2002-05-09
Posts: 19
Loc: Sydney
Les,

Codes a bit ruff at the moment but if I run the function by itself it works, in the script it fauls

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

Top
#21448 - 2002-05-16 03:33 PM Re: runnig a .exe on remote server
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
You're missing an EndIF at the bottom. I assume the UDF code is in there somewhere and that you just didn't bother posting it.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#21449 - 2002-05-16 03:41 PM Re: runnig a .exe on remote server
Colin Williamson Offline
Fresh Scripter

Registered: 2002-05-09
Posts: 19
Loc: Sydney
Les,

the last else is for extra code that works and the UDF's are at the bottom

Top
Page 1 of 3 123>


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, 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.072 seconds in which 0.024 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