srb Posted December 4, 2007 Share Posted December 4, 2007 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 Link to comment Share on other sites More sharing options...
Developers Jos Posted December 4, 2007 Developers Share Posted December 4, 2007 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")') SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
srb Posted December 4, 2007 Author Share Posted December 4, 2007 (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 December 4, 2007 by srb Link to comment Share on other sites More sharing options...
Developers Jos Posted December 4, 2007 Developers Share Posted December 4, 2007 (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 deniedAny ideas?ThanksAre you running the script from a network share or from a local directory to which the AD account doesn't have enough rights ? Edited December 4, 2007 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
srb Posted December 4, 2007 Author Share Posted December 4, 2007 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 Link to comment Share on other sites More sharing options...
Elix Posted December 12, 2007 Share Posted December 12, 2007 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now