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.
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.
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.
If trying to run a command in the 64-bit "Program Files" directory, use "
For example, instead of "C:\Program Files\Company\Product\Prog.exe", say "
NOTE: For this to work, the command must be run inside of a batch file.
If trying to run a command in the 64-bit "Windows\System32" directory, replace "System32" with "Sysnative" in the path.
For example, instead of "C:\Windows\System32\Defrag.exe", say "C:\Windows\Sysnative\Defrag.exe".
NOTE: The "Sysnative" alias will not be available on Windows 2003, unless the KB-942589 hotfix is applied.
Using the mklink command or fsutil hardlink create command, create a symlink or hardlink to the command you want to run, place this link outside of the "Program Files" and "Windows" directories, and use this link to run the command.
If the command *.exe doesn't need to be run from its own directory, copy it to a directory outside of "Program Files" and "Windows" and run it from there.
Use "\Windows\Sysnative\cmd.exe /c" to run a batch file. This will create a 64-bit shell for executing the entire batch file.
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