Fix windev prerelease version during elevation (#4908)

* Fix prerelease elevation cleanup

* Support restricted PowerShell in windev

* Use current PowerShell engine in windev
This commit is contained in:
Omar
2026-08-03 19:10:49 -05:00
committed by GitHub
parent 97e0711034
commit 97f2ad6e98
2 changed files with 32 additions and 2 deletions
+8 -2
View File
@@ -1,5 +1,11 @@
# Runs the pre-release version of winutil
$latestTag = (Invoke-RestMethod https://api.github.com/repos/ChrisTitusTech/winutil/tags).Name | Select-Object -First 1
$script = Invoke-RestMethod -Uri https://github.com/ChrisTitusTech/winutil/releases/download/$latestTag/winutil.ps1
Invoke-Command -ScriptBlock ([scriptblock]::Create($script)) -ErrorAction Stop
$uri = "https://github.com/ChrisTitusTech/winutil/releases/download/$latestTag/winutil.ps1"
$scriptPath = Join-Path $env:TEMP "winutil-$latestTag.ps1"
Invoke-WebRequest -Uri $uri -OutFile $scriptPath -UseBasicParsing -ErrorAction Stop
$executable = if ($PSVersionTable.PSEdition -eq 'Core') { 'pwsh.exe' } else { 'powershell.exe' }
$currentPowerShell = Join-Path $PSHOME $executable
& $currentPowerShell -ExecutionPolicy Bypass -NoProfile -File $scriptPath