Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 Import/Export (DTS) and Replication (2000)
 Access is denied error (xp_cmdshell)

Author  Topic 

Moe
Starting Member

1 Post

Posted - 2005-02-24 : 19:58:19
I have a batch file (C:\Copyfile.bat) that has following command:

COPY \\MPVISION3\D$\TempVision3\data.txt C:\data.txt

It works fine when I run from command prompt. But it does not work when I run from query analyzer. I receive "Access is denied" output message.

Note: I login using Window Authentication on my server and using follwing T-SQL:

EXEC master..xp_cmdshell 'C:\CopyFile.bat'

output
---------------------------------------------------------
NULL
C:\WINNT\system32>COPY \\MPVISION3\D$\TempVision3\data.txt C:\data.txt
Access is denied.
NULL

(4 row(s) affected)

Any idea what is wrong?

Moe

X002548
Not Just a Number

15586 Posts

Posted - 2005-02-25 : 14:10:04
You're running under the context of the SQL Server Agent Account..that account needs permission to write to that location



Brett

8-)
Go to Top of Page
   

- Advertisement -