Jump to content
Sign in to follow this  
jamestubberville

RunAs Registry Edit

Recommended Posts

jamestubberville

I recently updated AutoIT. All of my older scripts needed tweaking.

I've been editing my scripts and have them complete with the exception of one. I've been using the RunAsSet to modify a few registry entries. RunAsSet has consolidated to RunAs. I can't get the script to update a remote registry.

Local version of the script works:

Case $msg = $Uncac

RunAs(GuiCtrlRead($admin), @Computername, GUICtrlRead($password), 0, "REG add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system\ /v scforceoption /t REG_DWORD /d 0")

WinWaitActive("C:\WINDOWS\system32\REG.exe")

Send ("y")

Send("{ENTER}")

Remote Version Does not:

Parameters: Script is run by a user. Script elevates priviledges to Admin. Script is stand alone and can not call other scripts or executables. User can not be added to the administrators group. Remote system name "$remote" is entered by the user as needed.

Case $msg = $Uncac

$string = "Reg add \\" & GuiCtrlRead($remote) & "\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system /v scforceoption /t REG_DWORD /d 0"

RunAs(GuiCtrlRead($admin), GuiCtrlRead($remote), GUICtrlRead($password), 0, $string)

WinWaitActive("C:\WINDOWS\system32\REG.exe")

Send ("y")

Send("{ENTER}")

Need recommendations on elevating priviledges to edit registry or recommendation on elevating RegWrite to admin.

Edited by jamestubberville

Share this post


Link to post
Share on other sites
rajeshontheweb

can you please wrap your code in [ autoit ] & [ / autoit ] tags it makes the script more readable and less space consuming.

Also , just a doubt, why not user RegWrite - inbuilt autoit function is Reg Add superior to it? i'm just an amateur so just wondering if u had tried RegWrite, coz i felt more comfortable controlling autoit 'regwrite' than windows 'reg add'

RegWrite( "\\"&GuiCtrlRead($remote) &"\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system","scforceoption","REG_DWORD "0")

Can you check to see if this works for remote registry? because such statement works fine for me with local registry :-)

Edited by rajeshontheweb

Share this post


Link to post
Share on other sites
jamestubberville

Tried RegWrite; however, RunAs would not allow it to run. Kept receiving incorrect number of parameters error.

The Format for RunAs is Runas(admin, computer, pw, flag, file).

Inserting

RegWrite( "\\"&GuiCtrlRead($remote) &"\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system","scforceoption","REG_DWORD "0")
for file creates the parameter error.

Is there a method to elevate RegWrite and keep the original requirements? I've looked to no avail.

Share this post


Link to post
Share on other sites
Jim333

Tried RegWrite; however, RunAs would not allow it to run. Kept receiving incorrect number of parameters error.

The Format for RunAs is Runas(admin, computer, pw, flag, file).

Inserting

RegWrite( "\\"&GuiCtrlRead($remote) &"\HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\system","scforceoption","REG_DWORD "0")
for file creates the parameter error.

Is there a method to elevate RegWrite and keep the original requirements? I've looked to no avail.

Did anyone find a solution for this???

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.