Problems running 64-bit programs as Custom Processes

Issue:

On an x64 version of Windows, if you set a Custom Process in a GOexchange job to run a command in the "Program Files" or "Windows\System32" directory, GOexchange may fail to find the command or the command may otherwise fail to execute.

Cause:

Windows x64 includes a file system redirection feature, whereby if Windows detects a 32-bit process trying to access the "Program Files" or "Windows\System32" directories (which hold the 64-bit programs and support libraries), it redirects that process to the "Program Files (x86)" or "Windows\SysWOW64" directories (which hold the 32-bit programs and support libraries).

This redirection is essential to ensure that 32-bit processes get the 32-bit versions of necessary support libraries.  But this redirection is unhelpful (and largely self-sabotaging) when a 32-bit process is trying to run 64-bit program.  Windows isn't smart enough to know the difference and cannot tell if it should helpfully redirect a given access attempt by a 32-bit process or wisely allow the attempt to go through; it just dumbly redirects all access attempts.

The GOexchange Server components that run the Custom Processes are 32-bit processes.  When they attempt to access the "Program Files" or "Windows\System32" directories to run 64-bit commands for the Custom Processes, Windows intercepts those attempts and redirects them to 32-bit versions of those commands in the "Program Files (x86)" or "Windows\SysWOW64" directories.  For most 64-bit commands, there aren't any 32-bit versions on the system, so the redirection results in a failure to find the command.

Resolution:

Bypass Windows' file system redirection for the affected 64-bit command.

There are several ways to do this.  Some methods selectively bypass redirection for single commands; others can turn redirection off for all of the commands within a batch file.  You will need to pick the most appropriate method for your particular case.

Methods for bypassing file system redirection

NOTE: For this to work, the command must be run inside of a batch file.

NOTE: The "Sysnative" alias will not be available on Windows 2003, unless the KB-942589 hotfix is applied.

NOTE: This can bring about the reverse problem: that a 64-bit shell will be redirected away from commands in the 32-bit directories.

See also: Custom Processes