I have been using SQL Server 2016's SQL Server Agent with bottom setting and script for last 3+ years. It was/is working fine.
But, now, I am migrating everything to SQL Server 2019, but the same command does not work.
So, I am wondering if there is anything that I have to modify (in terms of script) because I am using SQL Server 2019.
When I use SQL Server Agent to run other Powershell script (which executes something within Powershell), it works.
When I run the Powershell now, and I am getting this error message:
-
1Have you looked at this? reddit.com/r/SQLServer/comments/jfrcyt/…Jonathan Fite– Jonathan Fite2024年08月13日 18:48:28 +00:00Commented Aug 13, 2024 at 18:48
-
@JonathanFite What does it mean by "you should use a Proxy to run Python just like you would SSIS"?Java– Java2024年08月13日 20:02:12 +00:00Commented Aug 13, 2024 at 20:02
-
1What's the error message?J. Mini– J. Mini2024年08月14日 22:32:14 +00:00Commented Aug 14, 2024 at 22:32
-
@J.Mini Please see the updated post with error mesage. Actually, when I just ran the Powershell file which executes Python file, I see the error on the top. It appears that SQL Server Agent is now out of scope. So strange.Java– Java2024年08月15日 00:56:58 +00:00Commented Aug 15, 2024 at 0:56
-
1@Java You're screwed. I've had similar problems on my own box. Unless you can grant the group policy that allows impersonation, then your only choice is to make the account a full Admin. Talk to your Windows people.J. Mini– J. Mini2024年08月15日 16:18:42 +00:00Commented Aug 15, 2024 at 16:18
1 Answer 1
If you're not going to specify the program to run the .py file, you need Windows to have a default for that file type. Instead, specify the python executable/binary. This would be an example of what your final line should be, but you'll need to edit it to point to your python binary:
Start-Process C:\Path\To\Python\Executable\python.exe "$cmd"
-
It appears that it is working (with modifying the line), but don't I have to fix the original issue with some type of AD or group policy?Java– Java2024年08月15日 18:59:14 +00:00Commented Aug 15, 2024 at 18:59
-
1Are you getting an additional error? If so, what is it?Dave.Gugg– Dave.Gugg2024年08月15日 19:06:21 +00:00Commented Aug 15, 2024 at 19:06
-
I do not see error now (by modifying that line). It is working. But, I am not sure whether I need to fix any set up in AD (for later).Java– Java2024年08月15日 19:08:51 +00:00Commented Aug 15, 2024 at 19:08
-
1That'll depend on whether you're using a different AD account for the SQL Agent than you were before.Dave.Gugg– Dave.Gugg2024年08月15日 19:20:39 +00:00Commented Aug 15, 2024 at 19:20
-
So, it is not like a major issue, but only affecting AD account for the "SQL Agent" then, I guess.Java– Java2024年08月15日 20:12:08 +00:00Commented Aug 15, 2024 at 20:12