Problem w/ xp_cmdshell & network share

  • EXEC master.dbo.xp_cmdshell 'dir r:\*.bak /OD' - this returns "The system cannot find the path specified."

    EXEC master.dbo.xp_cmdshell 'dir c:\*.bak /OD' - this works properly

    r:\ is mapped to a VM shared drive. The SQL Server service is starting with a domain account and the share/directory permissions are correct.

    Works fine from a DOS shell.

    What else should I be looking at?

  • Is firewall enabled between those servers. That might be one of the reasons. Also try giving the UNC path and check if you are able to perform the same successfully.

    Cheers,
    Sugeshkumar Rajendran
    SQL Server MVP
    http://sugeshkr.blogspot.com

  • No firewalls and the UNC approach WORKS. I'm still baffled as to why the mapped drive won't work.

  • SQL Server doesn't know how to spell "mapped drive"... you're stuck with the UNC approach... which isn't so bad... don't have to worry about the drive letter ever changing

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

  • You on Windows 2003?  Mapped drives does not work except from the desktop that mapped it, even if you leave that desktop logged in, the process that runs SQL can not access the mapped drive.

    Can't remember for sure if this worked to use mapped drives for SQL if running Windows 2000, but I seem to remember it did....

  • Thanks to all and I am on Win 2003.

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

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