cpremo Posted August 23, 2007 Share Posted August 23, 2007 (edited) I'm trying to use the following to run a registry update from a PC where the logged in person only has user rights. The "Registry Editor" dialog box comes up, but the ControlClick doesn't seem to take effect. ********************************************************** If Not IsAdmin() Then RunAsSet('administrator', @Computername, 'krispy') EndIf FileCopy("Z:\Client\Windows Update.reg", "C:\Novell\",1) FileCopy("Z:\Client\RegUpdate.bat", "C:\Novell\",1) Run("C:\Novell\RegUpdate.bat", "", @SW_HIDE) Opt("WinSearchChildren", 1) WinActivate("Registry Editor") Opt("MouseClickDelay", 10) ControlClick("Registry Editor", "", 6, "", 1) ;FileDelete("C:\Novell\Windows Update.reg") ;FileDelete("C:\Novell\RegUpdate.bat") Exit Edited August 23, 2007 by cpremo Link to comment Share on other sites More sharing options...
enaiman Posted August 23, 2007 Share Posted August 23, 2007 Not sure about but you could try to run your batch file using admin rights (RunAsSet). Also I'm not sure if Run can properly deal with batch files - maybe they need ShellExecute ? SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
cpremo Posted August 23, 2007 Author Share Posted August 23, 2007 Basically what I want to do is run a windows reg file called "Windows Update.reg" and update the registry with the administrator account. Link to comment Share on other sites More sharing options...
enaiman Posted August 23, 2007 Share Posted August 23, 2007 I imagined that. I suppose your batch file is running the reg one - right? As I said - I'm not sure about if the RunAsSet at the begining of your script extends this to EVERYTHING you will run within your script - so it looks like a good idea to run everything inside using RunAsSet. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
Danny35d Posted August 23, 2007 Share Posted August 23, 2007 RunAsSet() function only work for the Run() and Runwait() functions. The best way to do what you want is. If Not IsAdmin() Then RunAsSet('administrator', @Computername, 'krispy') EndIf FileCopy("Z:\Client\Windows Update.reg", "C:\Novell\",1) RunWait(@ComSpec & ' /c regedit /s "C:\Novell\Windows Update.reg"', @SystemDir, @SW_HIDE) AutoIt Scripts:NetPrinter - Network Printer UtilityRobocopyGUI - GUI interface for M$ robocopy command line Link to comment Share on other sites More sharing options...
cpremo Posted August 23, 2007 Author Share Posted August 23, 2007 DOH! Boy do I feel dumb. Thanks a bunch!! 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