XP_CMDSHELL Error

  • oradbguru

    Hall of Fame

    Points: 3121

    Hello, I have set up and configured xp_cmdshell using a proxy account and I am still getting the below error.

    The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information. [SQLSTATE 42000] (Error 15153)

    select @@version

    Microsoft SQL Server 2016 (SP2) (KB4052908) - 13.0.5026.0 (X64) Mar 18 2018 09:11:49 Copyright (c) Microsoft Corporation Enterprise Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 <X64> (Build 9600: )

    EXEC sp_configure 'xp_cmdshell';

    Capture

    Capture

     

    Use master

    EXEC sp_helprotect 'xp_cmdshell'

    Capture

    Any idea why this is still not working.

    • This topic was modified 4 months, 2 weeks ago by  oradbguru.
  • Jeff Moden

    SSC Guru

    Points: 995089

    When are you getting this error?  When you try to use xp_CmdShell?  If so, please post the code.

     

    --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.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."
    When you put the right degree of spin on it, the number 3|8 is also a glyph that describes the nature of a DBAs job. 😉

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

  • oradbguru

    Hall of Fame

    Points: 3121

    Sorry, I posted the wrong code.

    • This reply was modified 4 months, 2 weeks ago by  oradbguru.
  • oradbguru

    Hall of Fame

    Points: 3121

    I got it to work.  It turns out that the proxy was not set up on the linked server where the xp_cmdshell call is executed from.

    Thank you.

  • Jeff Moden

    SSC Guru

    Points: 995089

    oradbguru wrote:

    I got it to work.  It turns out that the proxy was not set up on the linked server where the xp_cmdshell call is executed from. Thank you.

    That sounds like it could be the worst way to use xp_CmdShell there is for purposes of security.  You really do need to post the code that's making the call across the linked server AND the code that gets executed on the linked server so we can help you avoid reading about yourself in the morning news after a breach.

    --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.
    "If you think its expensive to hire a professional to do the job, wait until you hire an amateur."--Red Adair
    "Change is inevitable... change for the better is not."
    When you put the right degree of spin on it, the number 3|8 is also a glyph that describes the nature of a DBAs job. 😉

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

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

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