I’m using SQL Server 2008 and running a batch file from SQL Server Agent. The batch file is located in my desktop. When I try to run the job I get an error: “access is denied.” The batch file runs successfully if I run it manually. Also, the job runs successfully if I put the batch file anywhere in the C drive or F drive and run it from Agent. Any idea why the access is denied if the batch file is in desktop? The agent service account has the sysadmin server role in SQL Server. Thanks.
Sql-server – Sql Server Agent fails to run batch from desktop
sql serversql-server-agent
Related Question
- Sql-server – Command fails as CmdExec job but succeeds from console
- Sql-server – Linked Server Error on SQL Agent Job
- Sql-server – T-SQL script doesn’t delete files when run as an agent job – does if run manually
- Sql-server – .bat file works manually, but does nothing in SQL Server Agent job
- Sql-server – 22046 “Impersonation error” running SQL Server Agent job
Best Answer
Yes. Because it is a rotten idea. The service agent account has no rights on your personal folders and your personal folders include the desktop. And you should keep it that way.
Your personal fodlers are btw., locked also for the admin accounts etc.
If you need sql agent to do something, I strongly suggest you agree on a location for that to happen and move the batch there.