mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-15 09:20:36 -06:00
Revert Admin Elevation
This commit is contained in:
parent
9b9d0c58f5
commit
75b466778b
12
windev.ps1
12
windev.ps1
@ -12,18 +12,6 @@
|
|||||||
Run in Admin Powershell > ./windev.ps1
|
Run in Admin Powershell > ./windev.ps1
|
||||||
#>
|
#>
|
||||||
|
|
||||||
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."
|
|
||||||
|
|
||||||
$script = if ($MyInvocation.MyCommand.Path) { "& '" + $MyInvocation.MyCommand.Path + "'" } else { "irm 'https://github.com/ChrisTitusTech/winutil/raw/main/windev.ps1' | iex"}
|
|
||||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
|
||||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
|
||||||
|
|
||||||
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs
|
|
||||||
|
|
||||||
break
|
|
||||||
}
|
|
||||||
|
|
||||||
# Function to fetch the latest release tag from the GitHub API
|
# Function to fetch the latest release tag from the GitHub API
|
||||||
function Get-LatestRelease {
|
function Get-LatestRelease {
|
||||||
try {
|
try {
|
||||||
|
Loading…
Reference in New Issue
Block a user