Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

exec master..xp_cmdshell : Access is denied..... WHY?

Status
Not open for further replies.

sandvenom

IS-IT--Management
Jul 24, 2001
3
US
I need to move, create and delete a file across the network, but when I use I network path I get an Access denied, can Someone help me?

EXAMPLE:
exec master..xp_cmdshell "echo Hello world > \\sql_server\c\test2.txt"

-----------------------------
output
-----------------------------
Access is denied.

(1 row(s) affected)
 

The account that SQL Server runs under doesn't have write permissions on \\sql_server\c\test2.txt. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
I see what you are saying but I don’t think the permission is the issue because I can run the same command like this:

But if I use:

exec master..xp_cmdshell "echo Hello world > c:\test2.txt"
It works great

But if I Use:
exec master..xp_cmdshell "echo Hello world > \\sql_server\c\test2.txt"
Access is denied.

"This 2 are the same machine, the only difference is I use a network path for one of them"


Any other ideas?
Thanks
 

Check permissions on the share C. Permissions on a share can be different than on the drive itself. Terry L. Broadbent
faq183-874 contains some tips and ideas for posting questions in these forums. Please review it and comment if you have time.
NOTE: Reference to the FAQ is part of my signature and is not directed at any individual.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top