Some remote commands must be customized for 64-bit or 32-bit versions of Windows. In these cases, the commands must be able to determine which operating system architecture is running on the remote computer.

This information is particularly important when the commands use Windows tools in the System32 directory. When the remote computer is running a 64-bit version of Windows, and the remote command is using a 32-bit session configuration, such as Microsoft.PowerShell32, Windows Remote Management (WinRM) loads a WOW64 process and Windows automatically redirects all references to the %Windir%\System32 directory to the %windir%\SysWOW64 directory. Tools that are in the System32 directory, but not in the SysWow64 directory, such as Defrag.exe, are not available.

When you try to use a tool that is not available on the remote computer, Windows PowerShell generates the following error message.

  Copy Code
ERROR: The term "<tool-name>" is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.

To detect 32-bit and 64-bit operating systems

  • To find the processor architecture that is being used for the computer in the session, use the value of the PROCESSOR_ARCHITECTURE environment variable.

    The following command uses the Invoke-Command cmdlet to run a command on the Server01 computer that gets its processor architecture.

      Copy Code
    invoke-command -computername Server01 -scriptblock {$env:PROCESSOR_ARCHITECTURE}

See Also