master..xp_cmdshell works. But Exec master..xp_cmdshell doesn't work

  • The server has MS SQL Server 2005 SP3.

    master..xp_cmdshell works against all the databases. But Exec master..xp_cmdshell doesn't work. For example,

    master..xp_cmdshell 'Echo Hello' works.

    Exec master..xp_cmdshell 'Echo Hello' doesn't work from my local pc. But if i remote login to the server, it works.

    I have sysadmin access.

    Any idea why it doesn't work from my local pc?

  • What's the error message that you get?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • It just hangs...It runs for ever and doesn't give any error message....

  • But if i remote login to the server, it works

    I'm pretty sure that's the nature of the beast and you won't be able to do much about that. This is especially true if the server is on another domain.

    --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)

  • I dunno, this one is a little weird. It sounds like the "two-hop rule" problem, but that should not affect xp_cmdshell, because it executes in a different context anyway. hmmm...

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • The only other thing that I can think of is that it is trying to open a console window for some reason. This will always be a problem, *unless* you are actually on the console. But then you should notice it...?

    [font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
    Proactive Performance Solutions, Inc.
    [/font]
    [font="Verdana"] "Performance is our middle name."[/font]

  • My local pc and the server in problem are in the same domain. The command doesn't work in my local pc.

    But the command works from my local pc if my local pc and the server(not the problem server) are in different domains.

  • I would ask the network team if they have blocked access to xp_cmdshell remotley, they did it at company I worked for, because they where told it was best practice, didn't tell the DBA team and we had to struggle to figure why legacy jobs and code etc where failing, just a geuss.

    Andrew

  • Thanks. I have contacted MS and they figured out that Network is blocking the xp_cmdshell. I am working with Network team on this. I will update you later.

Viewing 9 posts - 1 through 8 (of 8 total)

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