Jump to content
Sign in to follow this  
gjm72

access hklm part of registry

Recommended Posts

I am very new to autoit so bare with me. Our computers are running windows xp some with sp2 some with sp1 pro we have about 150 of them. Here is my problem. I need to change the proxy server address in internet explorer and since we are using per machine rather per user settings for the proxy address the value that needs to be changed is located in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ","http://192.168.100.2:8080" How can i create a script to grab admin rights from the machine it is being run on so that the script can change the ip address. If anyone can post a script for this that would be great.

Thank you!!!

Share this post


Link to post
Share on other sites

For some proxy setting UDFs, check out this thread IE proxy UDFs, 2 UDFs for IE proxy settings.

For the admin stuff, use RunAsSet and Run. However, then you can't just use the UDFs from the thread mentioned above. Btw. Why would you need admin rights to set the reg key? The UDFs use HKCU\...., where the user should have read/write access.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

I need admin rights because the proxy setting is per machine so the setting is in the hklm part not the hkcu part. Here is the script i tried to use, but it doesn't work.

; Set the RunAs parameters to use local adminstrator account

RunAsSet("Administrator", @Computername, "password")

; Run registry editor as admin

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ","http://192.168.1.2:8080")

; Reset user's permissions

RunAsSet()

Share this post


Link to post
Share on other sites

; Set the RunAs parameters to use local adminstrator account

RunAsSet("Administrator", @Computername, "password")

; Run registry editor as admin

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Internet Settings","ProxyServer","REG_SZ","http://192.168.1.2:8080")

; Reset user's permissions

RunAsSet()

As I said in my last post. You cant use RunAsSet with internal functions (RegWrite). RunAsSet has only an effect on Run(). The only way would be to use an external program like reg.exe an WinXP.

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

i wrote a program to make the change and call it from my script and it works perfect. thanks for the pointer.

Share this post


Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...