access denied for "reg query"

#1
Trying to query the registry to return location of Windows SDK installation. The key exists.

******** paste from cmd.exe run as admin ***************
D:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64>reg query "HKLM\SOFTWARE\Microsoft\Microsoft SDKs\Windows" /v "CurrentInstallFolder"
Access is denied.

D:\Program Files (x86)\Microsoft Visual Studio 9.0\VC\bin\amd64>
******************************************************************

Also tried it from C:\Windows\System32, same result.

How do I get the command to execute?
 


#2
I've changed permissions in the registry on the key but still doesn't work. I can execute the command on a different computer running the same OS.

Suggestions?
 


MikeHawthorne

Essential Member
Microsoft Community Contributor
#3
Hi

Have you tried this?


How to Enable the Administrator Account

Open the command prompt with elevated privileges by clicking the Start orb, All Programs, Accessories, right-click Command Prompt and then select Run as administrator.

Type or cut and paste...

net user administrator /active:yes

and then press Enter.

Log out and log back in as Administrator.

When you are done undue the process by doing the same thing and pasting in

net user administrator /active:no

Mike
 


#4
Mike,

Yes, I have the Administrator account enabled. Have not tried changing registery permissions etc. while logged in through the Administrator account because I'm logged in through another administrator-level account. I can certain try that when I get home but I wouldn't think it would matter. However I've been surprise before ...... many times.

I'll let you know what happens.


-ralph
 


#5
Using the Administrator account to change the permissions does not change the result, still no access.

One thing that is unclear, is denied access to RegEdit or is it to the registry itself?
 


MikeHawthorne

Essential Member
Microsoft Community Contributor
#6
Hi

You're over my head here.
I've never messed around with the SDK package.

I just don't know why it would block your ID, but the biggest problem with Windows 7 seems to be it's over protective security that stops people from doing everyday actions.

I've had it deny access to folders I made myself the day before.

Maybe some one can jump in here who has more knowledge of how this stuff works.

Mike
 


Last edited:
#7
Mike,

I have SDK packages on my laptop which runs Windows 7 Ult. 64-bit and don't have this problem, i.e. access denied to reg query. I think this is a pure Windows 7 problem on my desktop machine, something has gone awry with the OS.


-ralph
 


Josephur

Windows Forum Admin
Staff member
Premium Supporter
#8
Have you tried using the subinacl command to change the registry permissions?
Can download it from: Download details: SubInACL (SubInACL.exe)

Remember to run this in an Administrator command prompt.
Also note it installs the binary to "Program Files\Windows Resource Kits\Tools\" by default

Example:
subinacl /subkeyreg HKEY_CLASSES_ROOT\DesktopBackground\Shell\Display /setowner=Administrator (set the owner)
subinacl /subkeyreg HKEY_CLASSES_ROOT\DesktopBackground\Shell\Display /grant=Administrator=F (grant permission Full access)
 


#9
Have you tried using the subinacl command to change the registry permissions?
Can download it from: Download details: SubInACL (SubInACL.exe)

Remember to run this in an Administrator command prompt.
Also note it installs the binary to "Program Files\Windows Resource Kits\Tools\" by default

Example:
subinacl /subkeyreg HKEY_CLASSES_ROOT\DesktopBackground\Shell\Display /setowner=Administrator (set the owner)
subinacl /subkeyreg HKEY_CLASSES_ROOT\DesktopBackground\Shell\Display /grant=Administrator=F (grant permission Full access)
Yes, tried but have the same problem with it that I have with the "reg query" command, i.e. access denied. Can't even do a subinacl /help command, same result access denied.

I can run regedit but commands outside regedit such as "reg query" or the use of subinacl aren't allowed.
 


#10
Have you tried using the subinacl command to change the registry permissions?
Can download it from: Download details: SubInACL (SubInACL.exe)

Remember to run this in an Administrator command prompt.
Also note it installs the binary to "Program Files\Windows Resource Kits\Tools\" by default

Example:
subinacl /subkeyreg HKEY_CLASSES_ROOT\DesktopBackground\Shell\Display /setowner=Administrator (set the owner)
subinacl /subkeyreg HKEY_CLASSES_ROOT\DesktopBackground\Shell\Display /grant=Administrator=F (grant permission Full access)
Yes, tried but have the same problem with it that I have with the "reg query" command, i.e. access denied. Can't even do a subinacl /help command, same result access denied.

I can run regedit but commands outside regedit such as "reg query" or the use of subinacl aren't allowed.
 


Josephur

Windows Forum Admin
Staff member
Premium Supporter
#11
Uhm subinacl.exe /help works even if the user does not have admin privs, I'd say you have some serious issues on your machine if subinacl /help gives you access denied!

Perhaps a high level reg key thats needed for many operations has invalid permissions or is corrupted. Try to restore your system back to a previous date, or try using Sysinternals Process Monitor and monitor the subinacl.exe process to see why your getting an access denied message. You can download it from Windows Sysinternals: Documentation, downloads and additional resources

Also have you recently had any malware/viruses? Perhaps you got infected and some important registry key or file now has invalid permissions, not sure.

Other things to try might be boot in to safe mode and try running the command prompt as an Administrator.
 


#12
Oh yes, running malware and virus protection, have for years, and all that is clean.

Yes, something is clearly amiss with the OS. Ever since SP1, it has seemed flacky (not a technical term of course). I'll see if sysinternals process monitor can shed any light.

Otherwise it maybe time for a clean install, I hate those because the apps are a real pain.
 


#13
WHAT?? Everything just started working! I turned Process Monitor on, ran for awhile. Tried my "reg query" command and it worked. Been trying to solve this problem for couple weeks and have no idea what fixed it. This makes no sense to me.
 


#14
regedit has an undocumented feature left over from the dos days that will allow it to export
a registry key to a file:
REGEDIT /E outfile "HKEY_LOCAL_MACHINE\...\..."
It comes out in unicode however, and I haven't tested it on win7, and only runs on local machine.
 


Last edited:
This website is not affiliated, owned, or endorsed by Microsoft Corporation. It is a member of the Microsoft Partner Program.