Question

32bit vs 64bit Plans?

  • 18 September 2023
  • 3 replies
  • 80 views

Badge

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


3 replies

Badge

I note that the Linux binary on our Debian systems is 64bit

root:~# file /opt/amagent/amagent

/opt/amagent/amagent: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.18, Go BuildID=gmb-Ujurs-JxJsSayTul/mo3qDewtX7iNDQ7uH9y2/TgxT6RuucH_qqlLcaXZZ/rBeMBgUOP6uSTDJo7TSb, BuildID[sha1]=b4c5e2025352b5aa622d4bf10dd2ddb46630a7be, stripped

 

Userlevel 5
Badge

Our product team has eyes on this and it's absolutely something we're thinking about. I've passed on your post to them to help further the discussions! 

Userlevel 5
Badge +1

When developing worklets to avoid that pitfall, I’ve been testing code with 32-bit powershell running as NT SYSTEM. You will need to download psexec from Microsoft Sysinternals. Cannot stress how handy this is no matter what tool you are developing automation scripts for your windows environments in. 

 

psexec -s C:\windows\SysWOW64\WindowsPowerShell\v1.0\powershell.exe

Reply