0

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.

enter image description here

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:

enter image description here

8
  • 1
    Have you looked at this? reddit.com/r/SQLServer/comments/jfrcyt/… Commented Aug 13 at 18:48
  • @JonathanFite What does it mean by "you should use a Proxy to run Python just like you would SSIS"?
    – Java
    Commented Aug 13 at 20:02
  • 1
    What's the error message?
    – J. Mini
    Commented Aug 14 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
    Commented Aug 15 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
    Commented Aug 15 at 16:18

1 Answer 1

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"
5
  • 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
    Commented Aug 15 at 18:59
  • 1
    Are you getting an additional error? If so, what is it?
    – Dave.Gugg
    Commented Aug 15 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
    Commented Aug 15 at 19:08
  • 1
    That'll depend on whether you're using a different AD account for the SQL Agent than you were before.
    – Dave.Gugg
    Commented Aug 15 at 19:20
  • So, it is not like a major issue, but only affecting AD account for the "SQL Agent" then, I guess.
    – Java
    Commented Aug 15 at 20:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.