RegistryWriteKey Doesn't Create (Specific) Keys

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

RegistryWriteKey Doesn't Create (Specific) Keys

Post by JRL » Tue Jun 09, 2015 9:28 pm

This worked a year ago.

I have a script and part of what it does is disable the "Connections" tab for Internet Explorer "Tools" > "Options". Wrote it a couple of years ago and have not had problems until recently. The script has the line:

Code: Select all

RegistryWriteKey>HKEY_CURRENT_USER,Software\Policies\Microsoft\Internet Explorer\Control Panel,ConnectionsTab,1
I'm finding that the "Internet Explorer" key does not exist even after I run the script. If I instead run the following line with "Politech" substituted for "Policies" the entire path and value is created.

Code: Select all

RegistryWriteKey>HKEY_CURRENT_USER,Software\Politech\Microsoft\Internet Explorer\Control Panel,ConnectionsTab,1
After a little more experimenting I find I can't write anything under the HKEY_CURRENT_USER\Software\Policies\ key.What is up with not being able to write to the HKEY_CURRENT_USER\Software\Policies key?

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

Re: RegistryWriteKey Doesn't Create (Specific) Keys

Post by Marcus Tettmar » Thu Jun 11, 2015 7:02 pm

Are you on x64 or x86? If x64 maybe it's writing to the x86 hive and you need to tell it to write to the x64 hive by setting REG_64 to 1.

Or, it needs admin privs to write there and Macro Scheduler isn't running as admin?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: RegistryWriteKey Doesn't Create (Specific) Keys

Post by JRL » Thu Jun 11, 2015 7:55 pm

Thanks Marcus. Its working on 50 computers and failing on 10 but it used to work everywhere. Not sure how long its been failing but I'm guessing an update caused a restriction. I already tried Let>REG_64=1 with no success. I didn't think about admin privilege for Macro Scheduler. I'll try that and let you know.

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: RegistryWriteKey Doesn't Create (Specific) Keys

Post by JRL » Thu Jun 11, 2015 8:13 pm

Admin privilege was the answer.

I created a script with the line:

Code: Select all

RegistryWriteKey>HKEY_CURRENT_USER,Software\Policies\Microsoft\Internet Explorer\Control Panel,ConnectionsTab,1
Then I compiled that to CloseConnectionsTab.exe

Then created another script that contained:

Code: Select all

Let>RP_Admin=1
RunProgram>%script_dir%\CloseConnectionsTab.exe
Ran the second script and the RegistryWriteKey> in the compiled script worked.

Another question. Is there any way to use admin privileges without having a compiled macro?

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: RegistryWriteKey Doesn't Create (Specific) Keys

Post by JRL » Thu Feb 11, 2016 4:14 pm

A new question in the same vein.

Is there any way to write to HKEY_LOCAL_MACHINE? Run as Admin doesn't work. Turning off UAC doesn't help.

Edit: 2 minutes later. Never mind.... Let>REG_64=1 allowed the write.

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