ssmssharexp-cmdshelldirectory-listing

trying to understand xp_cmdShell


I know how to use xp_cmdshell to get a listing of a local directory. The statement below gives me a list of cvs files in the dir C:\TEST. I ran the statement in my locally installed SSMS.

EXEC Master..xp_cmdShell 'dir C:\TEST\*.csv /b'

However,

EXEC Master..xp_cmdShell 'dir \\ip-adress\share\folder\*.csv /b'

returns a 'No access'.

But running dir \\ip-adress\share\folder\*.csv /b in my commandshell does return a listing. Apparantly I as a user have sufficient rights. Then why does xp_cmdShell return a 'access denied' ?

Is xp_cmdSHell unusable with shares or has this to do with the account that issues the command? But if I started SSMS locally, should the command not run locally under my WIndowsaccount? Same as in commandshell?


Solution

  • I used a SSIS proxy based on my own credentials but it looks like the machine on which the SQL Server is running, is blocked from accessing that share