Sometimes, we may need running PowerShell scripts as part of a USD or UAM script jobs. Curiously, we experience different results when running on 32 bit or 64 bit windows computers.
Concretely, we can find that the Powershell scripts embedded in the SD Jobs work correctly when delivered to 32bits windows systems but they can occasionally fail when delivered to 64 bits windows systems.
Why am I getting errors when running powershell scripts from within a SD job on windows 64bit systems?
Client Automation 12.8 and above.
Both 32-bit and 64-bit versions of PowerShell are installed by default on a 64-bit platforms.
By default, when invoked, the Powershell arquitecture matches the one from the application it is invoked from. So, when launching it from a 64bit application the 64bit version of Powershell is invoked and when launching it from a 32bit application the 32bit version of Powershell is invoked.
As Client Automation is a 32bit application, the Powershell launched from within a SD Job is the 32bit one, which may have no access to 64bit resources needed by the script itself, raising the errors due to it.
In order to workaround this problem, force the execution of the 64bit version of Powershell from within the SD Job.