November 29, 2021 at 10:25 am
Been given a new server running Win 2019 & SQL 2019 unable to run bat jobs with SQL Agent
So to try & simplify & understand what is happening have a simple bat file that is called test.bat, contains the following
@echo off
echo Test Test Test
pause
SQL agent has full access rights to partition even temporarily granted Admin rights to account.
When running agent task, task runs but gives no errors.
Syntax within job properties c:\windows\system32\cmd.exe /c "E:\xxxxxxx\Test.bat"
Tried running a very simple agent job to call notepad.exe also alas no success.
Any pointers appreciated as this is driving me nuts 🙁
November 29, 2021 at 11:56 am
If you're running the .bat file as a Operating system (CmdExec) step, have you tried running it as a SQL Server agent proxy using credentials for a user that has the correct Windows permissions? If I remember rightly, it's not the SQL Server permissions that are important here, but the OS permissions.
How to post a question to get the most help http://www.sqlservercentral.com/articles/Best+Practices/61537
November 29, 2021 at 1:44 pm
Also, you do not want to be running anything which requires user interaction from the agent. eg pause, notepad etc.
ie The agent is running as its own process on the server.
You can also direct output to a file by specifying an output_file_name with sp_add_jobstep. (I think this is on the advanced job tab in SSMS.)
November 29, 2021 at 3:40 pm
Been given a new server running Win 2019 & SQL 2019 unable to run bat jobs with SQL Agent
So to try & simplify & understand what is happening have a simple bat file that is called test.bat, contains the following
@echo off echo Test Test Test pause
SQL agent has full access rights to partition even temporarily granted Admin rights to account.
When running agent task, task runs but gives no errors.
Syntax within job properties c:\windows\system32\cmd.exe /c "E:\xxxxxxx\Test.bat"
Tried running a very simple agent job to call notepad.exe also alas no success.
Any pointers appreciated as this is driving me nuts 🙁
Are you getting an error, or is it not showing you the output. In your example, ECHO Test test test, you won't get any output unless you direct the output to a file.
If its an error, what is the specific error?
Michael L John
If you assassinate a DBA, would you pull a trigger?
To properly post on a forum:
http://www.sqlservercentral.com/articles/61537/
November 30, 2021 at 4:03 pm
Thanks for your speedy replies contacted sys administrator numerous group policies had been applied.
Server now same as other SQL instances no issues running various batch files & agent jobs similar to other
instances.
Thanks again
December 1, 2021 at 7:05 pm
Thanks for your speedy replies contacted sys administrator numerous group policies had been applied.
Server now same as other SQL instances no issues running various batch files & agent jobs similar to other
instances.
Thanks again
Did the administrators explain what was different that caused the problems to begin with other than just "numerous group policies"?
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply