Jump to content

UAC problems running under user rights


Beekman
 Share

Recommended Posts

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.

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
Link to comment
Share on other sites

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.

This isnt much of a support reply, but im getting UAC problems too. My program wont even exicute if its just to turn off wifi and turn back on. I Get a compatibility issue popup. My solution is turning the UAC down to minimum; safe, no.

Edited by wakrein
Link to comment
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
 Share

  • Recently Browsing   0 members

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