mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 14:45:52 -06:00
Update windev.ps1
This commit is contained in:
parent
1ac24c236e
commit
d3ef94f175
@ -34,15 +34,15 @@ function RedirectToLatestPreRelease {
|
|||||||
Write-Host "Using latest Full Release"
|
Write-Host "Using latest Full Release"
|
||||||
$url = "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1"
|
$url = "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1"
|
||||||
}
|
}
|
||||||
|
|
||||||
$script = Invoke-RestMethod $url
|
$script = Invoke-RestMethod $url
|
||||||
# Elevate Shell if necessary
|
# Elevate Shell if necessary
|
||||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||||
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
|
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
|
||||||
|
|
||||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
||||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
||||||
|
|
||||||
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $(Invoke-Expression $script)" -Verb RunAs
|
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $(Invoke-Expression $script)" -Verb RunAs
|
||||||
}
|
}
|
||||||
else{
|
else{
|
||||||
|
Loading…
Reference in New Issue
Block a user