Run a 32 bit Powershell script on Sql Server Agent
-
02-06-2021 - |
Question
I have a powershell script that runs a 32 bit com object so when I run it in Powershell 64x it fails but runs fine in 86x
When I run it in a Sql Server Agent job it has the same 64x failure.
Is there a way around this? Like SSIS packages?
Solution
You can directly invoke the 32-bit version of PowerShell by calling it through the WOW64 path:
%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe
Using the -File command line argument you can pass the name of the script you would like to run.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow