User Rating: / 2
PoorBest 
Share

This is one of those weird tidbits of information that was extremely difficult to find, yet extremely helpful to have.  64bit Windows utilizes the "SYSWOW64" layer to create a 32bit operating environment for applications.  So when an application references a DLL in c:\windows\system32 (which oddly enough contains 64bit binaries in it) it is redirected to c:\windows\syswow64 (which oddly enough has 32bit binaries in it). The same holds true for the "C:\Program Files" folder (64bit) and the "C:\Program Files (x86)" folder (32bit).

I utilize a network management product (Solarwinds Application Performance Monitor) that is a 32bit application that runs on  Windows Server 2008 64bit server which can execute user created scripts to monitor virtually anything you could think of.  I needed to execute a powershell script to monitor the mount status of my Exchange 2007 information stores. 

The server had Exchange 2007 management tools installed on it, and Microsoft's installation routine wouldn't allow me to install a 32bit version of the Exchange Management tools on my 64bit version of Windows. Furthermore, the 64bit installation of Exchange Management tools doesn't install the 32bit powershell extensions to manage Exchange.   And to add insult to injury, the Exchange 2007 version of the powershell cmdlets do not support being remote execution using WS-Management.

Now this doesn't sound to bad, write a 64bit script, and call the 64bit version of powershell from a 32bit process.  Well that can be a doosey, without this following tidbit of information:

If you are running within a 32bit application space, Microsoft has left a small crack open to allow you to execute 64bit code through the "sysnative" folder.   Now, this isn't a normal folder, but if you access "C:\Windows\Sysnative" from a 32bit application it places you into the real "System32" folder (not the System32 folder that really points to SYSWOW64).

So in the end, I wrote a simple 32bit script, that in turn executed a 64bit script by calling:

c:\windows\sysnative\windowspowershell\v1.0\powershell.exe -file

Drop me a note if this tidbit of knowledge was useful!

Add comment


Security code
Refresh