Unable to Run Cross Site SQL Queries that have XP_CMDSHELL

  • I have many sql servers across 3 data centre/ sites however I can only execute xp_cmdshell queries to servers local to that datacentre/ site.

    Pure t-sql simple queries, e.g. @@Servername across site are fine. It is those that include xp_cmdshell don't work

    e.g. EXEC MASTER..XP_CMDSHELL 'dir /p'

    "Msg 64, Level 20, State 0, Line 0

    A transport-level error has occurred when sending the request to the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)"

    Anyone found this before, and what rule was blocking it from working?

    Regards

    Rob.

  • Are you trying to pull information across the network via a mapped drive on a local server?



    Shamless self promotion - read my blog http://sirsql.net

  • no, absolutely any xp_cmdshell would fail, e.g. "date /t".

  • I am just running the query in SSMS or Redgate MultiScript.

  • Does the SQL service account have "Act as a part of the operating system" permissions from within start--> administrative tools-->local security policy -->local security settings --> user rights assignment



    Shamless self promotion - read my blog http://sirsql.net

  • It wasn't on. I turned it on but the result was the same unfortunately.

    But to be clear I can run the query successfully on this and any other server in the same data centre/ location. It is only when I run it from our Administration box in another pyscially disparate location that it fails.

    I wondered if it would be a Firewall issue but our engineers weren't helpful in diagnosis from this angle.

  • Given that you are connected to the server via SSMS there should be no firewall issues involved.

    Does it show any further errors in the SQL log or the Windows Event logs?



    Shamless self promotion - read my blog http://sirsql.net

  • nope, none at all. I am running SSMS via an admin box, not locally to the servers.

  • Right, but the admin box connects to the remote servers for you to attempt running the xp_cmdshell, correct?



    Shamless self promotion - read my blog http://sirsql.net

  • yes, that's right.

  • Clustered servers?



    Shamless self promotion - read my blog http://sirsql.net

  • any sort of server, clustered and stand alone.

  • Are you able to open SSMS on the actual servers themselves and attempt to execute the xp_cmdshell or are you strictly limited to attempting it from your admin box?



    Shamless self promotion - read my blog http://sirsql.net

  • I'm also getting the same error while running xp_cmdshell....can someone please help...

    Msg 64, Level 20, State 0, Line 0

    A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer available.)

  • Anyone find a solution?

Viewing 15 posts - 1 through 14 (of 14 total)

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