How To Configure xp_cmdshell To Access Remote Server?
Hi there, I'm trying to get xp_cmdshell to provide a directory listing of all files and folder on a remote server. When I run the command in a command prompt window it executes fine: dir \\files\1234 However whenever I try to execute the same command from query analyzer using xp_cmdshell it errors: "Logon failure: unknown user name or bad password." The command I am running is: exec master.dbo.xp_cmdshell 'dir \\files\1234' How to configure the xp_cmdshell to execute successfully on the remote server? TIA.
When you run 'dir \\files\1234' on the command line you are executing as you (or whatever account you are logged in as). When you do it through SQL Server using xp_cmdshell, it is using the credentials of the SQL Server service. So it's likely that those 2 accounts have different access rights over the UNC path.