Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Question
Monday, May 3, 2010 10:14 PM
Hi,
I'm trying to use invoke-command to call a method on a COM object on a remote machine:
Invoke-Command server64 { new-object -com "32BitOnlyComProgId" }
The "server64" is a machine running Windows 2008 x64. The COM object is a 32-bit component. The above command fails because it seems that the script is running under 64-bit mode on the remote machine and can't get this COM object. Is there a way to specify that the script should run in 32bit mode on a remote machine?
Thanks,
Heng-yi
All replies (4)
Tuesday, May 4, 2010 3:57 AM ✅Answered | 3 votes
Try this
Invoke-Command server64 { new-object -com "32BitOnlyComProgId" } -ConfigurationName Microsoft.PowerShell32
Microsoft.PowerShell32 is the x86 PS Session configuration available on x64 OS.
Ravikanth
http://www.ravichaganti.com/blog
Twitter: @ravikanth
PowerShell 2.0 remoting - eBook
Wednesday, May 5, 2010 10:11 AM ✅Answered | 2 votes
You need to use Register-PSSessionConfiguration cmdlet and its ProcessorArchitecture parameter:
-ProcessorArchitecture <string>
Specifies a processor architecture for the configuration. This value determines whether a 32-bit or 64-bit version of the process that hosts Windows PowerShell is started when the configuration is used. Valid values are x86, AMD64, and IA64.
The default is determined by the processor architecture of the computer that hosts the session configuration.
Aleksandar Nikolić http://powershellers.blogspot.com http://twitter.com/alexandair
Tuesday, May 4, 2010 8:41 PM
Thanks. That works. Another question: if I want to create my own PS Session configuration, what property do I set to make it run in x86 mode?
Thanks,
Heng-yi
Tuesday, May 4, 2010 11:10 PM
Thanks. That works. Another question: if I want to create my own PS Session configuration, what property do I set to make it run in x86 mode?
Thanks,
Heng-yi
Please don't unmark a valid answer because you've asked a new one. Start a new thread.