cancel
Showing results for 
Search instead for 
Did you mean: 
Create Post
Level 8

Powershell Script Monitor - X86 Vs X64

All,

Im attempting to build a script monitor that uses an old x86 com object, i thought i could specify the but depth of the powershell monitor by specifying the "Platform to run polling job on:" to x86.  When i do this, i still received com errors due to the bit level, i performed the following to confirm that it is indeed running as x64..


$Test = $env:Processor_Architecture

Write-Host 'Statistic:' $Test

exit(0)

Output: ==============================================

Statistic: AMD64


Is there any way to force the powershell script monitor to run under x86, or am i stuck here?

--

note, ive tried other ways of forcing the script itself to relaunch as x86, but they dont seem to work either.

if ($env:Processor_Architecture -ne "x86")

{

   &"$env:windir\syswow64\windowspowershell\v1.0\powershell.exe" `

    -noprofile -file $myinvocation.Mycommand.path -executionpolicy bypass

exit

}

Tags (2)
0 Kudos
8 Replies
Level 12

See this

0 Kudos
Product Manager
Product Manager

The changes you made under the "Advanced" section are likely not taking effect within templated editor when clicking "Test". That's just a theory. You may want to change the "Platform to run polling job on" to "x86" and then save the template and view the resulting output from the polling job.

0 Kudos

Tried that as well, even after saving and allowing the poll to run as normal outside of the editor it still fails and records "AMD64"

0 Kudos

What version of SAM are you currently running?

0 Kudos

I had to alter your script slight since "x86" and "AMD64" aren't numbers, but it does appear to be working properly in SAM 6.1.1. I would recommend upgrading as it appears this may have been an issue in SAM 6.0.1.

PowerShell Script SAM.png

0 Kudos

Would you mind doing me a favor and testing on a "Remote Host" as well?

in my testing, local execution can be done under x86, remote seems locked into x64.

Thanks!

0 Kudos

Correct. The "Advanced" setting for running the Polling Job is related to the Orion Job Engine. E.G. 64bit Job Engine or x86 Job Engine. This setting does not control the bitness of PowerShell executed on remote hosts. To leverage 32bit PowerShell on the remote host you would need to account for this within your script, such as utilizing the Start-Job cmdlet with the -RunAs32 parameter.

0 Kudos

SAM 6.0.1

0 Kudos