Burgaud Posted August 9, 2020 Posted August 9, 2020 Here is what I have: I have an autoit script that is loaded when computer is booted as follows: Opt("TrayIconHide", 1) Opt("MustDeclareVars", 1) #include <Date.au3> GLOBAL $repository = "\\xxxxxxxxx\Computer Monitor.au3" GLOBAL $PID = -1 GLOBAL $timer = TimerInit() _LogMessage(StringTrimRight(@ScriptName,4) & " is now running.") while 1 if ProcessExists($PID) then $timer = TimerInit() elseif NOT FileExists($repository) then $timer = TimerInit() elseif TimerDiff($timer) > 15000 then _LogMessage($repository & " is not running.") local $autoit = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\AutoIt v3\AutoIt", "InstallDir") & "\AutoIt3.exe" if @error <> 0 then $autoit = RegRead("HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt", "InstallDir") & "\AutoIt3.exe" endif if @error <> 0 then _LogMessage("Could not find Autoit installation.") else $PID = ShellExecute($autoit, '"' & $repository & '" ', "", "") _LogMessage("Repository script executed with PID:" & $PID & " and @error:" & @error) endif $timer = TimerInit() endif sleep(500) wend func _LogMessage($text) local static $fname = @MyDocumentsDir & '\' & StringTrimRight(@ScriptName,4) & '.log' FileWrite($fname, stringFormat("%s %-12s %s\r\n", _NowCalc(), @ComputerName, $text) ) endfunc This script in turn, loads up another autoit script "Computer Monitor.au3" ($repository) that is stored/located in a NAS. This "Computer Monitor.au3" script has #RequireAdmin if NOT IsAdmin() then MsgBox(16 + 262144, "ERROR!", "Requires to run as Admin.") exit endif Problem is, computer asks for User Access Control (windows prevents screenshot so no screenshot) when it tries to load up the 2nd script. How do i override this? Or is this something not possible? Dan
rudi Posted September 7, 2020 Posted September 7, 2020 (edited) Hi Dan. UAC is in place for security reasons. So there is no (regular) way to bypass UAC. you could disalbe UAC at all, but that's not a good idea for security reasons. What do you want to accomplish, so that you need to use #RequireAdmin? Rudi. Edited September 7, 2020 by rudi Earth is flat, pigs can fly, and Nuclear Power is SAFE!
Mbee Posted September 9, 2020 Posted September 9, 2020 Burgaud, have you disabled UAC manually, external to your script, so that it's already disabled at boot time? I always do so and have experienced zero problems relating to that security setting since the first release of Windows 7 Pro. Or are you in an environment that forbids that? One minor nit: It is recommended never to treat integers as logicals. So instead of if NOT IsAdmin() then use if NOT IsAdmin() = 1 then ; or better yet... If IsAdmin() = 0 Then Of course, that won't fix your issue...
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