Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Tasklist used in Batch file causes ERROR: RCP service is unavailable.  (Read 1981 times)

0 Members and 1 Guest are viewing this topic.

Sogent

    Topic Starter


    Newbie

    • Experience: Beginner
    • OS: Unknown
    The batch file is trying to set the errorlevel and check it to branch to the proper command line to start a new command.

    @ECHO OFF
    FOR /F %%F in (%1) do(
    ECHO %%F
    Testlist /s %%F U administrator P dapassword | findstr StartRT.exe
    echo %ERRORLEVEL%
    IF %ERRORLEVEL%==1(
    ECHO "SERVICE IS RUNNING" ) ELSE (
    ECHO "SERVICE IS NOT RUNNING")
    )


    This is run from the command line by typing test.bat consoles.lst where the latter has three LAN  console addressed included.

    The output echoes the console address then list the ERROR listed above and then list the errorlevel that does not change.  In all trials it listthe last value set.

    Salmon Trout



      Genius

      Thanked: 758
      • Yes
    • Computer: Specs
    • Experience: Experienced
    • OS: Windows 7
    1. Your title says "Tasklist used in batch file" but the code you posted does not use Tasklist; it does mention something called Testlist though.

    2. Did you mean "The RCP Server is unavailable"?

    3. Check the status and startup type for the RPC and RPC locator services on the server that gets the error. Additional Services that may result in "The RPC Server is Unavailable" errors are the TCP/IP NetBIOS helper service, Distributed File System service and Remote Registry service. These services should both be set to automatic and started. The Kerberos Key Distribution Center (KDC) should be Started and Automatic on Windows 2000 and Windows 2003 DCs. It should not be started and set to Disabled in all other cases.

    4. You are not seeing up to date values of errorlevel because inside a FOR or other parenthetical structure if you SET a variable or try to read a changing system variable implicitly (like errorlevel, date, time etc) you need to use delayed expansion to get the value to expand properly inside that structure.

    Stirb nicht vor mir - Rammstein

    Sogent

      Topic Starter


      Newbie

      • Experience: Beginner
      • OS: Unknown
       ;D
      The testlist statement is a typo.  It is in my code tasklist.  I believe I have found the reason for  the  RCP Error.  I put " " around the object of FINDSTR and the error has stopped.  However, errorlevel is not updating.

      I will try to understand the delayed expansion you refer to.

      Thanks for your help

      Salmon Trout



        Genius

        Thanked: 758
        • Yes
      • Computer: Specs
      • Experience: Experienced
      • OS: Windows 7

      I will try to understand the delayed expansion you refer to.


      Google "delayed expansion batch" or search this forum.

      Good page here

      http://www.robvanderwoude.com/variableexpansion.php



      Stirb nicht vor mir - Rammstein