Jump to content
Sign in to follow this  
cpremo

Script Problem

Recommended Posts

cpremo

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 by cpremo

Share this post


Link to post
Share on other sites
enaiman

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 :)

Share this post


Link to post
Share on other sites
cpremo

Basically what I want to do is run a windows reg file called "Windows Update.reg" and update the registry with the administrator account.

Share this post


Link to post
Share on other sites
enaiman

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 :)

Share this post


Link to post
Share on other sites
Danny35d

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

Share this post


Link to post
Share on other sites
cpremo

DOH! Boy do I feel dumb. :)

Thanks a bunch!!

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  

×