none
How do I invoke 32-bit PS process from 64-bit PS process? RRS feed

  • Question

  • I have a PS script that runs on a 64-bit system under the 64-bit PS process. I need to be able to instantiate a 32-bit COM object (using "New-Object -ComObject $myProgID") but this apparently requires the execution to be done from the 32-bit PS process instead of the 64-bit PS process or it fails.  Note: I need to run the script under the 64-bit PS process initially because I'm also instantiating 64-bit COM objects.  Basically, this is an automated QA script that needs to test for the ability to instantiate both 32-bit and 64-bit COM objects when the script is invoked on a 64-bit system.

    How can I do this from my script such that New-Object cmdlet will be executed via the 32-bit PS process rather than the running 64-bit PS process?

    Or is there a better way to handle this?

    Friday, January 23, 2015 6:48 PM

Answers

  • Basically, you don't, because a 64-bit process can't instantiate a 32-bit COM object. But you can create a stub script and execute it with $Env:SystemRoot\SysWOW64\WindowsPowerShell\v1.0\powershell.exe.

    -- Bill Stewart [Bill_Stewart]

    Friday, January 23, 2015 7:11 PM
    Moderator

All replies

  • Basically, you don't, because a 64-bit process can't instantiate a 32-bit COM object. But you can create a stub script and execute it with $Env:SystemRoot\SysWOW64\WindowsPowerShell\v1.0\powershell.exe.

    -- Bill Stewart [Bill_Stewart]

    Friday, January 23, 2015 7:11 PM
    Moderator
  • Thanks!  That's pretty much the route I was headed down before I posted so at least I know I'm on the right track.
    Friday, January 23, 2015 8:04 PM