Invoking exe(on remote machine) from sql stored proc

  • Hi,

    We are looking for a way to invoke an exe from a stored proc in sql server and pass parameters to it. It can be done using the xp_cmdshell, but the issue is that the exe is on another server.

    Any pointers as to how to achive it???

  • Link the remote server first using sp_addlinkedserver 'remote server'. I assume you have authority in executing the exe on the remote server.

  • What does the EXE do?

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

  • It takes in some parameters from the proc, makes an http call and inserts the values in the database

  • Make the account of the SQL Server service domain admin, and you can do whatever you want. Even execute remote .exe files

    Before you go on doing this, please read on.

    This would be a certain way of loosing control over your network very soon. If not from on external attack, then because of an internal attack.

    Usually, you should avoid using xp_cmdshell. No wonder it is disabled by default in MS SQL Server 2005.

    If you can not avoid using it, you should use it for read only types of activities. But certainly not for executing .exe files.

    Try to find some workaround for this issue, because executing .exe file from a MS SQL Server is a security whole.

    But this is only my opinion.


    🙂

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply