How to run xp_cmdshell in linked server?

  • Hello.

    I have an sa Privilege in a sql server and i wanna run internal commands(For example : 'dir c:') in a linked server through xp_cmdshell.

    How can i do it?

    Have any ideas to run commands in a linked server with command prompt ?

    Best regards.

  • Depending on exactly you want to accomplish, look at the options from SQLCMD, Powershell, Dos Batch Files...

    Your posts heading "....run xp_cmdshell...." and content "...dir c:..." confuse me a bit.

    Warning: xp_cmdshell is disabled by default for a VERY good reason....try to avoid using it....especially as 'sa'...

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

  • I need something to run system commands in my linked server only in cmd.exe(Not with GUI programs and etc.) and I think xp_cmdshell is the best one.

    I should tell this again... I am the sa of Database A and I Linked Database B to A(There is no RDP or other programs between A and B)

    Now.. How can I run system commands(DIR for example) in Database B?

    (BTW I can accept all the risks)

  • If SQLCMD or Powershell can help me in this case, please gimme the exact statement of Query...

    thanks...

  • http://lmgtfy.com/?q=SQLCMD

    http://lmgtfy.com/?q=powershell+

    -----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    This thing is addressing problems that dont exist. Its solution-ism at its worst. We are dumbing down machines that are inherently superior. - Gilfoyle

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

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