How do I read 64-bit Registry values from VBScript running as a an msi post-installation task?

Posted by Joergen Bech on Stack Overflow See other posts from Stack Overflow or by Joergen Bech
Published on 2009-08-04T20:27:52Z Indexed on 2010/04/02 18:53 UTC
Read the original article Hit count: 567

Filed under:
|
|
|

I need to read the location of the Temporary ASP.NET Files folder from VBScript as part of a post-installation task in an installer created using a Visual Studio 2008 deployment project.

I thought I would do something like this:

Set oShell = CreateObject("Wscript.Shell")
strPath = oShell.RegRead("HKLM\SOFTWARE\Microsoft\ASP.NET\2.0.50727.0\Path")

and then concatenate strPath with "\Temporary ASP.NET Files" and be done with it.

On an x64 system, however, I am getting the value from the WOW6432Node (HKLM\SOFTWARE\Wow6432Node\Microsoft\ASP.NET\2.0.50727.0), which gives me the 32-bit framework path (C:\Windows\Microsoft.NET\Framework\v2.0.50727), but on an x64 system, I actually want the 64-bit path, i.e. C:\Windows\Microsoft.NET\Framework64\v2.0.50727.

I understand that this happens because the .vbs file is run using the 32-bit script host due to the parent process (the installer) being 32-bit itself.

How can I run the script using the 64-bit script host - or - how can I read the 64-bit values even if the script is run using the 32-bit script host?

© Stack Overflow or respective owner

Related posts about vbscript

Related posts about msi