batch script stops after winrs command

108 Views Asked by At
@(setlocal enableextensions enabledelayedexpansion
    echo off
    set "Node1=Node1"
    set "Node2=Node2"
    set "Node3=Node3"
    set "Cluster=Cluster1"
    set LOGFILE=C:\BatchLog.log
)

CALL:Main >> %LOGFILE% 2>&1

( ENDLOCAL
  CALL :END
  EXIT /B 0


)

:Main
    CALL :Connect_Remote "%Node3%"

    CALL :Print_NodeStatus

GOTO :EOF


:Connect_Remote
start winrs  -r:%~1 cmd
TIMEOUT /T 5
ECHO Login  to %COMPUTERNAME%
ECHO %DATE% %TIME%
ECHO.
ECHO %DATE% %TIME%
ECHO.
GOTO :EOF

:Print_NodeStatus
ECHO ***CURRENT STATUS OF SERVERS***
cluster.exe WINCLU01 node  /status
ECHO %DATE% %TIME%
ECHO.
GOTO :EOF

:Error
EXIT /B 0 %ERRORLEVEL%
GOTO :EOF

I have a batch script that needs to run on another server locally ( 4th server) but same VLAN. It needs to check if the servers (node1, node2, and node 3) in the cluster is UP and running. I have created subclass in my script:

:Connect_Remote and :Print_NodeStatus

After this part is run: start winrs -r:%~1 cmd

It doesn't continue to :Print_NodeStatus

What am I missing?

0

There are 0 best solutions below