Hi,
I have developed a powershell script that calls an executable with a time limit of 15 minutes
To implement this I downloaded the package for the Start_threadjob from the powershell library. The script runs as expected when executing the script on the server from powershell or as compiled exe file
Code:
# execute program as thread job with a maximum run time of 15 minutes.
$ESDjob = Start-ThreadJob { & $using:prgPath @using:prgArgs}
But when I run this as a step of a SQL agent job, the error below is thrown:
The term 'Start-ThreadJob' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
I have other PS modules that I downloaded that can be executed as SQL agent. What could cause this issue?