/build/static/layout/Breadcrumb_cap_w.png

Scripted registry access in 64-bit OS

I'm currently running Windows 7 x64, and whenever I use a KScript via direct action or launching a .vbs dependency file to read or write to the registry, it's accessing the 32-bit registry hive.

For example, when I write a value to HKLM\Software\Microsoft\Windows NT\CurrentVersion\AppCompatFlags, it's actually writing to:
HKLM\Software\WOW6432Node\Microsoft\Windows NT\CurrentVersion\AppCompatFlags, I suppose because it's coming from a 32-bit app, or system account, or something.

When I launch the same script as a local admin, it properly accesses the 64-bit hive at the location specified.

Any thoughts, or suggestions for being able to access the proper registry location?

0 Comments   [ + ] Show comments

Answers (9)

Posted by: dtuttle 15 years ago
Purple Belt
2
You might notice how the default Kbox script for defragmenting a computer is affected with this. You will have to send dos commands to the PC the same way.

|Dale
Posted by: mich3ael 14 years ago
Senior Yellow Belt
2
Sorry for dropping that question and then staying away so long.
I figured out a workaround that I've been using since... including the 64-bit version of wscript.exe as a dependency with any scripts that need access to the 64-bit registry hive. Since the KBOX agent is a 32-bit app, all the defaults are set to 32-bit hives, and any scripts are launched with the 32-bit version of wscript.exe. So by including and forcing execution with the 64-bit wscript.exe, I have direct access to the 64-bit registry hive without having to significantly change my scripts or execution commands (except changing KBOX_SYS_DIR to KACE_DEPENDENCY_DIR when I specify where to launch wscript.exe from).
Posted by: cblake 15 years ago
Red Belt
1
Sounds like you've uncovered a bug. Have you contacted support@kace.com?
Posted by: jkatkace 15 years ago
Purple Belt
1
What version of the KBOX and the agent are you on?

Have you tried explicitly writing the registry via the Launch Command function?
Posted by: dtuttle 15 years ago
Purple Belt
1
I've been through this...

for 32bit - call the 32bit cmd
for 64bit call the 64bit cmd


http://msdn.microsoft.com/en-us/library/aa384187(VS.85).aspx
Posted by: GillySpy 15 years ago
7th Degree Black Belt
1
To support what Dale said here's a sample command line to update 64-bit keys

c:\windows\system32\cmd.exe /c regedit.exe /s ourfile.reg


Even if we know about issues however we would like to hear from affected customers -- your ticket will either report a new bug or register a vote against an existing bug which helps it get visibility within engineering.
Posted by: scottlutz 13 years ago
Orange Senior Belt
1
Since there hasn't been any activity on this post for a while, and since I came across the same issue when trying to query a 64-bit registry, I thought I would share my findings.

From this page:
http://msdn.microsoft.com/en-us/library/aa393067%28v=vs.85%29.aspx

I was able to craft a vbscript that queries both 32 and 64 bit registries, depending on the target platform.

HTH,
Scott
Posted by: snissen 13 years ago
Fourth Degree Green Belt
1
I'm an experienced Windows 7 and XP packager who has not worked with 64-bit Windows until now. When I read this article, I was astounded at the differences for scripters between 32- and 64-bit Windows:
http://csi-windows.com/blog/all/27-csi-news-general/266-scripting-migrating-and-managing-registry-data-in-64-bit-windows

I went on to take this class so I could understand the things I needed to know to work in 64-bit Windows using the KBOX 1000:
http://csi-windows.com/courses/windows64bit

I highly recommend this class as the quickest way to understand the subtle differences in the operating environments. And remember that the KBOX agent, like the SCCM client, is a 32-bit executable! Sande
Posted by: sbequette 13 years ago
Orange Belt
1
for this very reason i am in process of converting most of my scripts to powershell.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ