File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -296,10 +296,16 @@ jobs:
296296 }
297297 Write-Host "ARP: $($entry.DisplayName) $($entry.DisplayVersion)"
298298
299- if ($env:INSTALL_SOURCE -eq 'winget') {
299+ $identity = [Security.Principal.WindowsIdentity]::GetCurrent()
300+ $principal = [Security.Principal.WindowsPrincipal]::new($identity)
301+ $isElevated = $principal.IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)
302+ if ($env:INSTALL_SOURCE -eq 'winget' -and -not $isElevated) {
300303 winget uninstall --exact --id Microsoft.FoundryDevPack --source winget `
301304 --silent --disable-interactivity --accept-source-agreements
302305 } else {
306+ if ($env:INSTALL_SOURCE -eq 'winget') {
307+ Write-Host 'Runner is elevated; using the persisted uninstaller for this user-scope package.'
308+ }
303309 & $entry.DisplayIcon uninstall
304310 }
305311 if ($LASTEXITCODE -ne 0) { throw "uninstall exited $LASTEXITCODE" }
You can’t perform that action at this time.
0 commit comments