Reputation: 87
I'm using xp_cmdshell to get files information from network share like this:
EXEC master..xp_cmdshell 'dir \\Server\share\folder'
but i get output 'access is denied'
I figured out my account was NT Service\mssqlserver
that can't get access to local system. In my case I can't change the service account to local system because it will require restarting the service.
Is there a way to get access with NT Service or anything I can do? Thanks for the help.
Upvotes: 0
Views: 3757
Reputation: 5694
If you are using a domain:
SERVER1
and you need to access a share on SERVER2
, you should grant read permissions to YOURDOMAIN\SERVER1$
. This will allow access to this share to any service that is running on SERVER1 with network access (Local System, Network Service, any NT Service), in other words, all services except those running under Local Service or a particular user account.If you are not using a domain, I believe the only options are:
Upvotes: 1