Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2006
    Posts
    12

    Unanswered: xp_cmdshell always return 'null'

    I have this program that I want to invoke from SQLServer funny thing is I can invoke this from command line but could not get it to work via 'xp_cmdshell' on this particular server. When I invoke run the following from SQLServer Query Analyser I always get 'NULL' returned.
    I tried just running EXEC master..xp_cmdshell 'dir ' and it worked, so I am certain it is not a SQL rights problem.

    FYI, I executed the same code on another machine and it worked. I just cannot figure out why it is not working on this one server?
    Can anyone help? thanks

    ----

    DECLARE @command varchar(500)
    SET @command = 'c:\Server\Client\abc.exe BBB/XX B,AAAA'
    EXEC master..xp_cmdshell @command

  2. #2
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    I think xp_cmdshell requires sysadmin permissions. Check books online.
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  3. #3
    Join Date
    Apr 2006
    Posts
    12
    I had already granted the rights to non sysadmin by going thru the SQLProxy user and assigning a user other than sysadmin, therefore I am pretty sure it is not a Proxy user problem.

    I am confused when you said that it is a rights issue.
    If it is a rights issue, won't my test on "xp_cmdshell 'dir'" fail?

  4. #4
    Join Date
    Nov 2004
    Location
    on the wrong server
    Posts
    8,835
    Provided Answers: 6
    Is the server login that you are using in the application the same account you set up as the proxy account. You do know this is not very secure?
    “If one brings so much courage to this world the world has to kill them or break them, so of course it kills them. The world breaks every one and afterward many are strong at the broken places. But those that will not break it kills. It kills the very good and the very gentle and the very brave impartially. If you are none of these you can be sure it will kill you too but there will be no special hurry.” Earnest Hemingway, A Farewell To Arms.

  5. #5
    Join Date
    Apr 2006
    Posts
    12
    The xp_cmdshell is actually called from a database trigger. The proxy account is a windows domain user.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •