Hi,
I often find myself running into problems when writing worklets which don’t work as intended. Most of the time the root cause is because I’d failed to remember that the Automox Agent is a 32bit binary and calls 32bit PowerShell.
Prefixing my Remediation Code with the following code blocks resolves the issue most of the time, but sometimes it does not, for example if I want to do something to a machine in both the 32 and 64bit registries in the same worklet.
#############################################################################
#If Powershell is running the 32-bit version on a 64-bit machine, we
#need to force powershell to run in 64-bit mode .
#############################################################################
if ($env:PROCESSOR_ARCHITEW6432 -eq "AMD64") {
write-warning "It seems we're running 32bit Powershell within a 64bit OS. Executing 64bit Powershell....."
if ($myInvocation.Line) {
&"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile $myInvocation.Line
} else {
&"$env:WINDIR\sysnative\windowspowershell\v1.0\powershell.exe" -NonInteractive -NoProfile -file "$($myInvocation.InvocationName)" $args
}
exit $lastexitcode
}
I’m interested to know, are there any plans to make a 64bit agent for Windows?
Thanks
Steve