0

I am currently looking to remove Adobe Acrobat Reader from an ecosystem, and have been able to complete the bones of the ps script. I know Adobe products don't like to play nice, but I at least want to have an attempt here. Whenever I run this script in /qn, I get Error 1730. Since its spawning msiexec, i'm assuming UAC is not passed during /qn or /quiet, as whenever I allow for a basic interface using /qb, a UAC popup occurs and I am able to remove it completely afterwards.

This is my simple code that i've been utilizing:

function regvalue {

    $global:guid = Invoke-Command -ScriptBlock { Get-ItemPropertyValue $global:regpath 'ENU_GUID'}
    $global:storage = $global:guid

}


function caller {

    regvalue
    $global:creds = Get-Credential -Credential Domain\user
    $global:command = Start-Process "msiexec.exe" -arg "/x $global:storage /qb /norestart" -Credential $global:creds -wait
    $global:command

}

$global:regpath = 'HKLM:\Software\Wow6432Node\Adobe\Acrobat Reader\DC\Installer'

caller

All this is doing essentially is querying the registry for the uninstall string or the ENU_GUID in Adobe terms. Once it gets the value it executes the msiexec with the string as the argument as well with any trailing parameters.

I cannot feasibly push this out if it requires a UAC prompt every time, which this script requires currently to execute. I'm logged in on a admin account, I've tried running ps in admin, and i've tried forcing a parameter check in the argument itself (which i suspect is redundant), none of which has been a workaround.

Basically, is there any simple workaround to ensure a UAC push from ps that i'm missing here?

  • Are you looking for a self-elevating script, i.e. one that re-invokes itself with elevation on demand? As an aside: it's best to avoid global variables, as they are _session_-global and therefore outlive the script that defines them. – mklement0 Oct 28 '22 at 19:15
  • If you want to elevate the `Start-Process` call, use `-Verb RunAs`, but note that you then cannot use `-Credential`. You'll have to _nest_ `Start-Process` calls if you want to run with elevation _as a specific user_. – mklement0 Oct 28 '22 at 19:17
  • Does this answer your question? [How to avoid UAC prompt while running powershell script](https://stackoverflow.com/questions/38658661/how-to-avoid-uac-prompt-while-running-powershell-script) – Dennis Nov 01 '22 at 18:12
  • It is of the similar vein, but i did not necessarily have the same use case. In this case, adding the parameter -verb RunAs fixed the issue for me. – Merrick Nov 01 '22 at 20:43
  • Then your post should be closed as a duplicate of https://stackoverflow.com/q/7690994/45375 and https://stackoverflow.com/q/55314557/45375 – mklement0 Nov 01 '22 at 21:00

0 Answers0