Sign in to follow this  
Followers 0
srb

RegWrite with Administrative Permissions

6 posts in this topic

Hi,

Any suggestions how I can write a registry key with administrative permissions without calling an external program such as reg.exe?

I've tried using the RunAsSet function but this doesn't seem to apply to the RegWrite function

E.g.

RunAsSet("administrator", "AD Domain Name", "password", 2)

RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CUSTOMUPDATE\ZFD\AGENT\SP2", "UPDATENUMBER", "REG_DWORD", "10")

If the user has local admin permissions the the registry key is created/modified successfully.

If the user does NOT have local admin permissions the registry key is not created/updated.

Thanks

Share this post


Link to post
Share on other sites



what about?:

RunAsSet("administrator", "AD Domain Name", "password", 2)
Run(@AutoItExe & ' /AutoIt3ExecuteLine  "RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CUSTOMUPDATE\ZFD\AGENT\SP2", "UPDATENUMBER", "REG_DWORD", "10")')

:)


Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

what about?:

RunAsSet("administrator", "AD Domain Name", "password", 2)
Run(@AutoItExe & ' /AutoIt3ExecuteLine  "RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\CUSTOMUPDATE\ZFD\AGENT\SP2", "UPDATENUMBER", "REG_DWORD", "10")')

:)

Jos,

Thanks for the reply.

I've added your code into my script but I get the following error:

Line -1:

Error: Unable to execute the external program.

Access is denied

Any ideas?

Thanks

Edited by srb

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Jos,

Thanks for the reply.

I've added your code into my script but I get the following error:

Line -1:

Error: Unable to execute the external program.

Access is denied

Any ideas?

Thanks

Are you running the script from a network share or from a local directory to which the AD account doesn't have enough rights ? Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions        Beta files                                                          Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

Are you running the script from a network share or from a local directory to which the AD account doesn't have enough rights ?

The exe is running from a UNC path where the user has read only permissions.

I'll run the exe locally to verify that it's a network issue.

Thanks

Share this post


Link to post
Share on other sites

Hi,

I try to use the following code :

RunAsSet('Admin', 'AD domaine', 'Password', 0)
Run(@AutoItExe & ' /AutoIt3ExecuteLine  "RegWrite("HKEY_LOCAL_MACHINE\SOFTWARE\Namtuk\wpe", "Message_AutoReply", "REG_SZ", "dormir")')

But I have the following error message box:

Line 1:

RegWrite(HKEY_LOCAL_MACHINE\SOFTWARE\Namtuk\wpe, Message_AutoReply, REG_SZ, dormir")

RegWrite(HKEY_LOCAL_MACHINE^ERROR

Error: Missing separator character after keyword

The code is used locally on the machine

Can you help me

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