0
@(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?

C1ark05
  • 5
  • 3
  • @KJ FYI I know that it requires USERNAME and password. However it works without it. – C1ark05 Jul 27 '21 at 14:36
  • I need in my script that once it is connected remotely to the server using: start winrs -r:"server" cmd it will be able to run script on the remote CMD. – C1ark05 Jul 27 '21 at 14:38
  • @KJ how will you be able to accomplish this? I need in my script that once it is connected remotely to the server using: start winrs -r:"server" cmd it will be able to run script on the remote CMD. – C1ark05 Jul 27 '21 at 15:24
  • I cannot find anything that prevents the routine `:Print_NodeStatus` from running. Why are you using `start` to run `winrs`? Have you tried without `start`? – aschipfl Jul 28 '21 at 11:07

0 Answers0