Jeff Key

It works on my machine

My Job

My stuff

Old stuff

Useful Stuff

32-bit registry access from WSH script running in x64 Windows

We use a hybrid approach for pulling the latest "good" binaries to our machines every day. A VBS bootstrapper starts the process, and one of the things it does is check the registry. Sounds reasonable, right? It was for the past few years, but now there's a problem when running this script on a 64-bit OS: It doesn't find the registry values.

64-bit Windows uses a number of things to make 32-bit apps live happily in a 64-bit world. One of these is the registry redirector. Simply, the OS gives 32-bit apps their own view of certain parts of the Windows registry, including HKLM\Software. Our VBS file looks for a value that's added by the .NET installer, which is a 32-bit process. The gotcha is that VBS files are associated with the 64-bit wscript.exe, so when it runs and looks for the value insterted by the 32-bit .NET installer, it can't find it.

Luckily, a 32-bit version of wscript is included in the %windir%\SysWOW64 directory. Launching a VBS with this version will give you access to the 32-bit sections of registry.
Posted: Apr 26 2005, 09:23 PM by jeffreykey | with 4 comment(s)
Filed under: ,

Comments

Sheboldaev Boris said:

Exactly, nice to see I'm not the only one :)

The steps I had to pass to find how it goes, just to express my happiness:

1. You write a VBS with calls to some 32-bit application DLLs, and it works fine on your local machine (WXP I guess).

2. You put it on the x64-server... And get the message "ActiveX component can't create object: 'XXX'", Code: 800A01AD.

3. You check the application on the server - it works, and obviously able to find all its DLLs!

4. You try to call CreateObject for some other system class like FileSytemObject - it works too!

5. You go to registry and see all your keys under WOW6432Node key.

6. That's when You become enlighten - the 64-bit version of wscript can not find Your 32-bit registry keys at all. Thanx to MS again - just another gift in x64-platform - "registry redirection which is transparent to the user" (support.microsoft.com/.../896459).

7. You write "x64 wscript" on google and here You are :)

# February 12, 2008 6:09 AM

totalnetsolutions.net » 64-bit Windows Headaches said:

Pingback from  totalnetsolutions.net » 64-bit Windows Headaches

# October 13, 2008 11:28 AM

Richard DeZego said:

Thanks, your suggestion worked for me.

# February 18, 2009 5:30 PM

Gabriel said:

Thanks a lot  I was with this exactly nightmare. Worked like magic....

# March 27, 2009 1:09 PM
Leave a Comment

(required) 

(required) 

(optional)

(required)