HKEY_LOCAL_MACHINE writing issue

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
OmniSwift
Newbie
Posts: 3
Joined: Mon Jun 28, 2010 4:09 am
Location: USA - Tucson, AZ

HKEY_LOCAL_MACHINE writing issue

Post by OmniSwift » Thu Aug 05, 2010 7:19 pm

Is there something extra I have to do to write to the HKEY_LOCAL_MACHINE registry?

I found several posts writing to this registry, but none (I found) mentioned anything special that had to be done first.

I've been manipulating the HKEY_CURRENT_USER w/ no problems.

But there is a parameter I have to change in the HKEY_LOCAL_MACHINE.

At first I thought I had a registry redirect problem (ie the WOW6432NODE issue), but this is not the case. I can't write to HKEY_LOCAL_MACHINE under a 64 bit (as WOW6432NODE redirect or REG_64 direct) or 32 bit OS.

I also don't "think" I have a security issue as I can modify the parameter manually using regedit. Also, I'm the admin on one of the two OSs I'm working with. Neither give me a problem w/ regedit.

Note: I don't have any problems READING from HKEY_LOCAL_MACHINE.

Here's the code:

Code: Select all

//This Works
RegistryWriteKey>HKEY_CURRENT_USER,SOFTWARE\X,MLPFile,15000
RegistryReadKey>HKEY_CURRENT_USER,SOFTWARE\X,MLPFile,MLValue
mdl>MLValue
//Displays 15000

//This does not?
RegistryWriteKey>HKEY_LOCAL_MACHINE,SOFTWARE\X,MLPFile,15000
RegistryReadKey>HKEY_LOCAL_MACHINE,SOFTWARE\X,MLPFile,MLValue
mdl>MLValue
//Displays blank as write did not work

-X

User avatar
Marcus Tettmar
Site Admin
Posts: 7393
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Aug 06, 2010 8:10 am

Administrator privileges are required to write to HKEY_LOCAL_MACHINE. Are you logged in as the administrator and running Macro Scheduler with administrator rights? If not, you won't be able to write to HKLM.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

OmniSwift
Newbie
Posts: 3
Joined: Mon Jun 28, 2010 4:09 am
Location: USA - Tucson, AZ

HKLM

Post by OmniSwift » Fri Aug 06, 2010 7:36 pm

I thought about that. On one machine I have Administrator privileges, on the other(s), I don't (and have no way to get it).

However, if the problem were this, why can I write to the key using Regedit?. I can manually modify the key this way on other machines using Regedit (even the ones where I don't have Administrator privileges).

If I don't find an automatic solution, I'll just use regedit for all the machines. However, it has been very convenient to let the program automatically detect problems and update the registry automatically when needed (for the other keys I manipulate).

No need to delve too deeply on this issue. I thought I would throw it out there in case I was headspacing something.
-X

User avatar
Marcus Tettmar
Site Admin
Posts: 7393
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: HKLM

Post by Marcus Tettmar » Fri Aug 06, 2010 8:27 pm

OmniSwift wrote: I can manually modify the key this way on other machines using Regedit (even the ones where I don't have Administrator privileges).
That is not possible. Not unless you're using Windows 95 or something. All current versions of windows will not allow HKLM to be modified unless you have administrator privs.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts