Jump to content

RegWrite on Vista


Recommended Posts

Hi all

I'm having problem writing to registry on Vista. The registry is "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\".

What I need to do is create the "Explorer" new Key, however I wasn't able to do that with a simple

RegWrite("'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")

I made sure the user has admin rights.

Any help would be appreciated.

Link to comment
Share on other sites

RegWrite ( "keyname" [,"valuename", "type", value] )

Your syntax is a bit off,

try something like

RegWrite("'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies",'Explorer','Reg_SZ','Value')

Edit: removed code tags... WAY to big of a box for one line..

Edited by Kerros

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

RegWrite with only the Keyname parameter is supposed to create the key if it doesn't exist.

With the other parameters it'll create a new Entry in the Key itself.

However I'm not even able to create the new key in the registry.

Also, note that the line

RegWrite("'HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer")

works on XP, not Vista. I'm suspecting it has something to do with Vista policies. Is there any way to deal with that through autoit?

Edited by gukki
Link to comment
Share on other sites

Guess I've never just created a key before, I always place a value in there, so your syntax would have been correct.

The only thing I can think of then is UAC. I know you stated that he as admin rights, but try #RequireAdmin, and see if they are getting the UAC prompts stopping the registry from being edited.

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

The only thing I can think of then is UAC. I know you stated that he as admin rights, but try #RequireAdmin, and see if they are getting the UAC prompts stopping the registry from being edited.

Thanks for the suggestion. I put #RequireAdmin in but there's no prompts coming up.

(I haven't used #RequireAdmin before, is it supposed to have prompts right from the start if you're not admin?)

Link to comment
Share on other sites

That is going to have to be a question for a mod or developer.

I haven't needed to use that setting before, but I know that it works for some scripts running on Vista. From my understanding it should be the same as right clicking and using the run as admin setting.

On all my Vista systems, I just turn off UAC and I don't seem to have the same issues that others have.

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

Tried on a couple of machines, both with UAC disabled. Interesting thing is one works (registry is modified correctly) while the other isn't. (both without prompts even using #requireAdmin)

Any ideas on that?

Link to comment
Share on other sites

Check the permissions of the "Policies" key. On my vista machine the User doesn't have create rights.

I double checked the Policies key I'm modifying, the permission setting for both machines for the user are identical. I also checked "EnabledLUA" and it's set to 0. This is very strange.

On a related question, is it possible to change the UAC settings through autoit?

Link to comment
Share on other sites

  • Administrators

Unless the user is an administrator they can't change that key. If they are an administrator and UAC is ON they can't change that key unless #requireadmin is in your script.

What permissions are you seeing? maybe someone else has already messed them around.

Link to comment
Share on other sites

Unless the user is an administrator they can't change that key. If they are an administrator and UAC is ON they can't change that key unless #requireadmin is in your script.

I do have #requireadmin in my script. The user has admin rights and I ran Disable UAC through msconfig (and rebooted).

What permissions are you seeing? maybe someone else has already messed them around.

For the user I see only Read Allow checked (Full Control and Special Permissions are unchecked) for Policies key in the registry on both machines.

Edited by gukki
Link to comment
Share on other sites

As for disableing UAC with Autoit you should be able to.

One way of turning off UAC is through MSConfig which uses this command:

C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

so doing an:

#RequireAdmin

RegWrite('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies','EnableLUA','REG_DWORD',0)

should work, but if you can't write to that value you could always do what MS does and run the reg.exe through a command window.

Kerros===============================================================How to learn scripting: Figure out enough to be dangerous, then ask for assistance.

Link to comment
Share on other sites

As for disableing UAC with Autoit you should be able to.

One way of turning off UAC is through MSConfig which uses this command:

C:\Windows\System32\cmd.exe /k %windir%\System32\reg.exe ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f

so doing an:

#RequireAdmin

RegWrite('HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies','EnableLUA','REG_DWORD',0)

should work, but if you can't write to that value you could always do what MS does and run the reg.exe through a command window.

Thanks Kerros, I'm now able to turn off UAC through Autoit, that eliminates one layer of possible error from users doing it manually.
Link to comment
Share on other sites

  • 2 weeks later...

Gukki,

have you checked to see if the machine that you are trying to modify is 64 or 32 bit? I am running 64 bit Vista Ultimate and have been working on registry modifications and have determined that if you are running 64 bit then you must add the 64 in the key i.e. hklm64 or it does nothing. I would start there and then move forward.

Wolfeman

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...