The above script is trying to write a file to the data folder of another server.
When I execute the cmd from the DOS cmd window, it works fine. However, when I run it through a stored procedure, I keep getting 'Access Denied.'
SQLAgent is listed as a user with full access on the target's data folder. Just in case, the logon id from the source server is listed as a user with full access on the target server's data folder. Yet still I get the error.
Don't know the answer, but I know how to find out.
If you use auditing from MS on the target directory, you should be able to see (within the event viewer) who is trying to access the directory. This will (or should help you) in terms of setting-up the proper security.
Originally posted by mferrell
Yeah, we did that but it didn't really tell us much.
Was there an entry on the target server to indicate that a user tried to access the folder? I'm guessing that SQL Agent is a local account on your SQL Server and not a domain account. If this is the case, then you will need to enable guest and allow guest to access the folder.
The alternative is to make the SQLAgent account a domain account, then you should have little difficulty.