Question

I'm working on a script that is supposed to install some software from a link within internet explorer and unfortunately the site requires 32bit internet explorer to work. Is there a way to force a 32bit internet explorer window to open on 64bit machines? The script works fine when running from a 32bit machine.

$ie = New-Object -ComObject InternetExplorer.Application
$ie.Navigate2($url)
$ie.Visible = $true
Was it helpful?

Solution

$url = "http://www.google.com"
$shell = New-Object -ComObject WScript.Shell
$shell.Exec("C:\Program Files (x86)\Internet Explorer\iexplore.exe $url") | Out-Null

OTHER TIPS

One solution is to explicit launch powershell.exe 32bit version using the full path under the SysWOW64 folder (C:\windows\syswow64\WindowsPowerShell\v1.0\powershell.exe) and run your script.

It should be noted that MSIE's bit level is based heavily on the version. IE9 had separate 32/64bit versions that could be executed independently but IE10+ is fully 64bit core (on 64bit systems) with sub processes that can run pages in 32 or 64bit based on a logic tree (see links below). Enhanced Protected Mode (EPM) can force untrusted sites to run in full 64bit mode (see articles below for details). This resulted in many Add-Ons being incompatible with EPM such as Adobe Reader's in-browser viewer which up until v11.0.7 did not have a 64bit capable component (EPM forces 64bit execution).

http://blogs.msdn.com/b/ieinternals/archive/2012/03/23/understanding-ie10-enhanced-protected-mode-network-security-addons-cookies-metro-desktop.aspx

http://blogs.msdn.com/b/asiatech/archive/2013/12/25/how-internet-explorer-enhanced-protected-mode-epm-is-enabled-under-different-configurations.aspx

I don't know how to achieve what you're looking for but the above information may help you avoid a pitfall.

I don't know the answer for PowerShell, but in C you would pass CLSCTX_ACTIVATE_32_BIT_SERVER to CoCreateInstance. Perhaps you know how to translate that to PowerShell-land?

Note: In the code I have that does this, there's a comment: "The presence of this flag on 32 bit XP makes the call fail" (followed by some threats of violence directed towards Microsoft's API developers that I won't publish here). The code goes on to add the flag only when running on 64-bit Windows.

The easiest solution to your problem is to Start Powershell in 32 bit.

Launch

Windows Powershellx86

Path

C:\Windows\syswow64\Windowspowershell\v1.0\powershell.exe
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top