Problem with a script

All questions related to installations, configurations and maintenance of Advanced Host Monitor (including additional tools such as RMA for Windows, RMA Manager, Web Servie, RCC).
Post Reply
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Problem with a script

Post by mp1 »

Hi,

We have a little problem with a simple script.
When we start the script in the command line, then we have no problems,
within in the script manager, we get the following error:

Command: cmd /c D:\Hostmonitor\Scripts\tftpservice_test.cmd

'C:\Windows\System32\TFTP.exe' is not recognized as an internal or external command,
operable program or batch file.

This would be the simple script:


Code: Select all

@ECHO OFF
SET DHCPCLUSTER=xxx
SET TFTPNODEA=some IP
SET TFTPNODEB=some IP
SET TFTPACTIVENODE=%TFTPNODEA%

IF EXIST %~n0.conf SET /P TFTPACTIVENODE=<%~n0.conf

C:\Windows\System32\TFTP.exe -i %TFTPACTIVENODE% GET pxeboot.0 && (DEL /F pxeboot.0 & ECHO scriptres:Ok:%TFTPACTIVENODE% GOTO :EOF)
What do we wrong, why will be tftp.exe no recognized?
HM v 8.84 on Windows Server 2008 R2 (64 bit)

Thanks in advance

Martin
KS-Soft Europe
Posts: 2832
Joined: Tue May 16, 2006 4:41 am
Contact:

Problem with a script

Post by KS-Soft Europe »

Looks like problem is caused by Windows File System Redirector.
Try to move 'C:\Windows\System32\TFTP.exe' to non-system directory.
E.g. to 'C:\TFTP\TFTP.exe'
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Re: Problem with a script

Post by mp1 »

KS-Soft Europe wrote:Looks like problem is caused by Windows File System Redirector.
Try to move 'C:\Windows\System32\TFTP.exe' to non-system directory.
E.g. to 'C:\TFTP\TFTP.exe'
aha, thanks, that's it :-)
mp1
Posts: 199
Joined: Tue Mar 07, 2006 3:24 am

Post by mp1 »

Hi,

Unfortantely I have no a further problem with the script, it seems that HM is not recogizen the "goto" command in the script.

Do you have any idea, what could be wrong?

This is the awnser, I will get, when I do a test within the script manager:

Code: Select all

D:\Hostmonitor\Scripts\TFTP.exe -i %TFTPACTIVENODE% GET %PXEFILE% && GOTO ACTIVE
ECHO scriptres:Ok:Active TFTP Node %TFTPACTIVENODE%
scriptres:Ok:Active TFTP Node 10.10.128.25 
GOTO :EOF
via cmd I will get:
scriptres:Ok:Active TFTP Node 10.10.128.25


Code: Select all

@ECHO OFF
SET DHCPCLUSTER=tlndhcp.tirol.local
SET TFTPNODEA=10.10.x.x
SET TFTPNODEB=10.10.x.x
SET TFTPACTIVENODE=%TFTPNODEA%
SET PXEFILE=pxeboot.0

IF EXIST %~n0.conf SET /P TFTPACTIVENODE=<%~n0.conf

IF EXIST %PXEFILE% DEL /F %PXEFILE%

D:\Hostmonitor\Scripts\TFTP.exe -i %TFTPACTIVENODE% GET %PXEFILE% && GOTO ACTIVE

IF "%TFTPACTIVENODE%"=="%TFTPNODEA%" (
SET TFTPACTIVENODE=%TFTPNODEB%
) ELSE (
SET TFTPACTIVENODE=%TFTPNODEA%
)

ECHO %TFTPACTIVENODE% > %~n0.conf

D:\Hostmonitor\Scripts\TFTP.exe -i %TFTPACTIVENODE% GET %PXEFILE% && GOTO FAILOVER

GOTO DISABLEDHCPPXE

ECHO scriptres:Bad:Failover Error

:ACTIVE
ECHO scriptres:Ok:Active TFTP Node %TFTPACTIVENODE%
GOTO :EOF

:FAILOVER
C:\Windows\System32\winrs.exe -r:%DHCPCLUSTER% NETSH DHCP SERVER SET OPTIONVALUE 66 STRING %TFTPACTIVENODE%
C:\Windows\System32\winrs.exe -r:%DHCPCLUSTER% NETSH DHCP SERVER SET OPTIONVALUE 67 STRING %PXEFILE% 
ECHO scriptres:Ok:Failover to TFTP Node %TFTPACTIVENODE%
GOTO :EOF

:DISABLEDHCPPXE
C:\Windows\System32\winrs.exe -r:%DHCPCLUSTER% NETSH DHCP SERVER DELETE OPTIONVALUE 66
C:\Windows\System32\winrs.exe -r:%DHCPCLUSTER% NETSH DHCP SERVER DELETE OPTIONVALUE 67
DEL %~n0.conf
ECHO scriptres:Bad:DHCP PXE disabled
GOTO :EOF
Thank again,

Martin
KS-Soft
Posts: 13012
Joined: Wed Apr 03, 2002 6:00 pm
Location: USA
Contact:

Post by KS-Soft »

1) HostMonitor does process scripts. Script is processed by program that you have specified in "Start cmd" parameter (cmd.exe in this case).

2) I am not sure how "GOTO :EOF" can be processed, I do not see "EOF" mark in this script.

3)
>ECHO scriptres:Ok:Active TFTP Node %TFTPACTIVENODE%
>scriptres:Ok:Active TFTP Node 10.10.128.25
>GOTO :EOF
This looks like ECHO ON was executed :roll:
However script was executed in the same way and script provided the same result: scriptres:Ok:Active TFTP Node 10.10.128.25
Have you tried to execute test using this script?

Regards
Alex
Post Reply