xp_cmdshell & UNC

  • I am using xp_cmdshell to call an FTP batch file. The batch file itself references a network directory via its UNC. When I run the batch file alone (outside of Sql Server) on the database server it runs fine. However, when I try to run it using xp_cmdshell inside a stored proc - it fails on the UNC share. I've even tried mapping the share to a network drive and changing the FTP batch file to use the mapped drive - still fails using xp_cmdshell.

    My database server, and the file server the FTP batch file is referencing are both Win2K machines - we recently switched to active directory services.

    Can anyone help me figure out a workaround?

    Thanks!!

  • Make sure the account that you are using for the SQL Server Services and Agent (if you are scheduling it as a job) has access to the UNC share.

    Hope that help!

     

  • Only users with sysAdmin rights can execute xp_cmdshell from the database or job. Another method is create a windows ID and register it as a domain user and then use that ID to execute xp_cmdshell.

     

     



    Regards,
    kokyan

Viewing 3 posts - 1 through 2 (of 2 total)

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