PSHELL switch for 32- or 64-bit

  • This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.
#1
Since Windows 7, all 64-bit Microsoft Windows operating systems come with a 32-bit and 64-bit version of PowerShell.

The 64-bit version is located at;
Code:
%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe
...while the 32-bit version is located at;
Code:
%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe
32-bit COM objects cannot be used in the 64-bit version of PowerShell, only in the 32-bit version of PowerShell.

Using the -RunAs32 option of Start-Job does allow the use of 32-bit COM objects in 64-bit PowerShell, but the persistent PowerShell interpreter (PSHELL) is lost. (Cannot be used)

(eg. https://jpsoft.com/forums/threads/pshell-and-receive-job.8419/)

I am suggesting that an option be made available for PSHELL, either in the TCMD.INI file, OPTION, etc., that would determine if PSHELL uses the 32-bit or 64-bit version of PowerShell. This would allow 32-bit COM objects to be used with the persistent PowerShell interpreter (PSHELL).

My 32-bit COM objects were developed using Microsoft Visual Basic 6.0, and PowerBASIC 10, both of which are 32-bit applications, with no hope of being migrated to 64-bit versions.

Joe
 
#3
Thankyou for the reply.

I can run the 32-bit version of PowerShell from a 64-bit version of TCC, so I will just use
Code:
%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -file whatever.ps1
or
Code:
%SystemRoot%\syswow64\WindowsPowerShell\v1.0\powershell.exe -command whatever
instead of using PSHELL when I need to access a 32-bit COM via PowerShell from 64-bit TCC.

Joe