Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

UAC problems running under user rights

$
0
0
Hello Everybody,

I am using an script to install software as soon as a client trigger the old software.
Because it is running under the user I have to install te software under administrator right.
So far I have no problems.
The problem start when i want to disable UAC before install en enable UAC after install.
I dont want to be depending on User having to click ok before te install begin. Also because the install consist more then 1 install.
If a user is not clicking the UAC ok within 2 minutes the install is stopped.

I have searhting to internet for the right script but untill now, I haven't found it. Despite all the good advice in this forum not to disable the UAC.
I have to disable it.

So I hope someone can help me to complete the script, so that it can run flawless.

[ autoit ]         
While 1     If Not ProcessExists("msiexec.exe") Then ExitLoop     Sleep(1000) WEnd sDisableUAC() Func sDisableUAC() Local $Result , $sHKLM ,$sPath $sHKLM = "HKEY_LOCAL_MACHINE" $sPath = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\" RegWrite($sHKLM & $sPath ,"ConsentPromptBehaviorAdmin","REG_DWORD","0") Sleep(1000) EndFunc $cmd1 = 'c:\temp\mcupgrade\install\setup /s /v"/qb!-"' $cmd2 = 'c:\temp\mcupgrade\elevate c:\temp\mcupgrade\fixpack\setup /s /v"/qb!+"' Local $size1 = FileGetSize("c:\temp\mcupgrade\install\setup.exe") Local $size2 = FileGetSize("c:\temp\mcupgrade\fixpack\setup.exe") If $size1 = 173408 AND $size2 = 7219000 Then     Local $pid = RunAsWait("account", "", "password", "", '"' & @ComSpec & '" /c ' & $cmd1, @SystemDir)     ProcessWaitClose($pid)     RunAsWait("account", "", "password", "", '"' & @ComSpec & '" /c ' & $cmd2, @SystemDir)  EndIf   SEnableUAC() Func sEnableUAC() Local $Result , $sHKLM ,$sPath $sHKLM = "HKEY_LOCAL_MACHINE" $sPath = "\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System\" RRegWrite($sHKLM & $sPath ,"ConsentPromptBehaviorAdmin","REG_DWORD","5") Sleep(1000) EndFunc

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>