none
SCOM - SQL Monitoring via SQL Server RunAs Addendum Management Pack RRS feed

  • Question

  • Hi,

    When I click "Create HealthService Login as SysAdmin Task" I got this error:

    'sqlcmd.exe' is not recognized as an internal or external command,
    operable program or batch file.
    
    

    This is happen just in one of SQL servers.

    How can I resolve it?

    Thanks

    Sunday, January 19, 2020 1:39 PM

Answers

  • Hi,

    There may be several causes to this issue, for example:

    - The system can't find the sqlcmd.exe (or bcp.exe, isql.exe) tool, because the path to this tool is not specified in the System Environment Variable “PATH”.

    - The appropriate tool is not installed to your computer. (Download HERE)


    Best regards,
    Leon



    Blog: https://thesystemcenterblog.com LinkedIn:

    • Marked as answer by Jon Rush Tuesday, January 28, 2020 12:35 PM
    Sunday, January 19, 2020 4:57 PM

All replies

  • In older versions of RunAs Addendum MP, this task runs the following command : 

     <WorkingDirectory>$Target/Property[Type="SQL2014Disc!Microsoft.SQLServer.2014.DBEngine"]/ToolsPath$\Binn</WorkingDirectory>
     <CommandLine>sqlcmd.exe -E -S $Target/Property[Type="SQL2014Disc!Microsoft.SQLServer.2014.DBEngine"]/ConnectionString$ -Q "sp_addsrvrolemember 'NT SERVICE\HealthService', 'sysadmin'"</CommandLine>

    As you can see, it runs sqlcmd.exe inside the "Binn" folder located right under the folder discovered as the "Tools Path" for the SQL instance.

    From your error message, it is pretty obvious sqlcmd.exe is not present in that folder, or maybe that folder isn't properly discovered, or not discovered at all. You can check that in the instance properties.

    The latest version of the MP does things a bit differently : it relies on native powershell commands instead of calling an external executable, so it shouldn't fail. But that latest version only works with the latest "Version Agnostic" SQL MP.


    Sunday, January 19, 2020 4:54 PM
  • Hi,

    There may be several causes to this issue, for example:

    - The system can't find the sqlcmd.exe (or bcp.exe, isql.exe) tool, because the path to this tool is not specified in the System Environment Variable “PATH”.

    - The appropriate tool is not installed to your computer. (Download HERE)


    Best regards,
    Leon



    Blog: https://thesystemcenterblog.com LinkedIn:

    • Marked as answer by Jon Rush Tuesday, January 28, 2020 12:35 PM
    Sunday, January 19, 2020 4:57 PM
  • Hi Jon,
     
    On SQL server 2017, SSMS has its own implementation of the SQLCMD-compatible interpreter. SQLCMD is a separate download. If our SQL version is 2017, please download it from the link Leon provided.
     
    Hope it can help.
     
    Best regards.
    Crystal

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com

    Monday, January 20, 2020 1:44 AM
  • Hi Jon,

    How's everything going? Was our issue resolved? If there's any update, please let us know.

    Best regards.
    Crystal


    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Thursday, January 23, 2020 5:58 AM
  • Hi Jon,
     
    Thanks for marking the reply as answer. To make our thread clear to read, please let me write a summary:
     
    Issue Definition:
    ===================
    When click “Create HealthService Login as SysAdmin Task" , the following error occurs:
    -----------------------------------------------------------------------------------------
    'sqlcmd.exe' is not recognized as an internal or external command,
    operable program or batch file.
    ------------------------------------------------------------------------------------------
     
    Solution:
    ==================
    - The system can't find the sqlcmd.exe (or bcp.exe, isql.exe) tool, because the path to this tool is not specified in the System Environment Variable “PATH”.
    - The appropriate tool is not installed to the computer. (Download HERE)
     
    Thanks for posting in our forum. Have a nice day!
     
    Best regards.
    Crystal

    Please remember to mark the replies as answers if they help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Wednesday, January 29, 2020 8:28 AM