Jump to content

Adding Dynamic Registry settings


Recommended Posts

Hello,

i am new to AutoIT and need some help. I would like to create a simple script/program to ask the user what to input. Once I have that input i would like to modify a specific registry setting and import that back into the registry.

Can anyone help me with this.

Thank you

Link to comment
Share on other sites

lets say i wanted to add a site the the trusted site list. If i wanted to add *.aaa.com i would import the following registry key:

[HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\aaa.com]

"*"=dword:00000002

i see i can add the key as follows:

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\aaa.com")

question is how do i also add "*"=dword:00000002 and make it so the "aaa.com" is whatever value the user inputs?

Thank you,

Link to comment
Share on other sites

Thank you, i would also like to add a feature to this program to run "gpupdate /force"

I think i can run gpupdate by using:

Run("gpupdate /force")

_WinWaitActivate("C:\WINDOWS\system32\gpupdate.exe", "")

Send("n{ENTER}n{ENTER}")

can you help me in creating a button that would give me the option to run gpupdate /force

Thank you,

Link to comment
Share on other sites

Thank you, i would also like to add a feature to this program to run "gpupdate /force"

I think i can run gpupdate by using:

Run("gpupdate /force")

_WinWaitActivate("C:\WINDOWS\system32\gpupdate.exe", "")

Send("n{ENTER}n{ENTER}")

can you help me in creating a button that would give me the option to run gpupdate /force

Thank you,

Link to comment
Share on other sites

Here you have what you are asking for:

$value = InputBox("User input", "Enter your input:")

If ($value <> "") Then
RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains\" & $value, "*", "REG_DWORD", "00000002")
EndIf

:blink:

I got this part easily enough, but how do I execute a RegWrite command to HKLM if the user doesn't have local admin rights?

I tried RunAs("username" , "domain" , "password" , @SystemDir & "\REG.EXE Add HKLM\SOFTWARE\Policies\Microsoft\Windows\CurrentVersion\Internet Settings\ZoneMap\Domains /v $value /t REG_DWORD /d 2 /f"), but it doesn't change the registry value.

Is there a way to do a RunAs( "username" , "domain" , "password" , RegWrite("HKLM...")?

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...