Sign in to follow this  
Followers 0
daslick

Runas Registry

6 posts in this topic

I have a function that uses run-as, which I am trying to add a registry key with.

I am trying to send the following commands to the function.

reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d 217.128.149.16:8080 /f

I tried putting them inside my function _ra("here") but it doesn't work because of the quotes that have to be around the registry keys in order to tell that the words Internet and Settings go together.

How do I work around this issue?

Share this post


Link to post
Share on other sites



Several options:

  • If your _ra() function takes a commandline as a string parameter, try this:
    _ra('reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
  • Use RegWrite() and have the script call itself as your other user. (Plenty of examples in the forum)
  • Load the other user's hive and RegWrite it directly. (Ditto on examples)

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

Share this post


Link to post
Share on other sites

I can't use regwrite - the user is not an admin. My _ra() function uses the password to run the command.

I wish I could use regwrite - it is much easier to use....

this is what I tried just now

_ra('reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyEnable /t REG_DWORD /d 1 /f')
        _ra('reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Internet Settings" /v ProxyServer /t REG_SZ /d " & $proxy & " /f")
and it did not work.... :lmao:

Share this post


Link to post
Share on other sites

Hold up... does httpsetproxy set the proxy for internet explorer or only if you are downloading files from within the program? If it saves the proxy settings I could use that...

Share this post


Link to post
Share on other sites

Does regwrite use runasset()'s credentials?

Share this post


Link to post
Share on other sites

Hold up... does httpsetproxy set the proxy for internet explorer or only if you are downloading files from within the program? If it saves the proxy settings I could use that...

It only affects InetGet/InetGetSize within your script.

Does regwrite use runasset()'s credentials?

No, not unless you're calling your own script with the RunAsSet credentials, as I suggested. See this thread for some examples: http://www.autoitscript.com/forum/index.php?showtopic=30015

[font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font]

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  
Followers 0