Jump to content

Recommended Posts

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

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

Posted

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

Posted

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

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...