mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-16 01:40:35 -06:00
fix
This commit is contained in:
parent
a6d4d47a88
commit
ede8733b9b
@ -47,19 +47,23 @@ $sync.ProcessRunning = $false
|
|||||||
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."
|
||||||
|
|
||||||
$wtInstalled = Get-Command wt.exe -ErrorAction SilentlyContinue
|
$script = if (Test-Path "$PSScriptRoot\winutil.ps1") {
|
||||||
$pwshInstalled = Get-Command pwsh -ErrorAction SilentlyContinue
|
"$PSScriptRoot\winutil.ps1"
|
||||||
if ($pwshInstalled) {
|
|
||||||
$powershellcmd = "pwsh"
|
|
||||||
} else {
|
} else {
|
||||||
$powershellcmd = "powershell"
|
"irm christitus.com/win | iex"
|
||||||
|
}
|
||||||
|
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) {
|
||||||
|
"pwsh"
|
||||||
|
} else {
|
||||||
|
"powershell"
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($wtInstalled) {
|
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) {
|
||||||
Start-Process wt.exe -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -File $PSScriptRoot\winutil.ps1 -Run" -Verb RunAs
|
"wt"
|
||||||
} else {
|
} else {
|
||||||
Start-Process $powershellcmd -ArgumentList "-ExecutionPolicy Bypass -NoProfile -File $PSScriptRoot\\winutil.ps1 -Run" -Verb RunAs
|
$powershellcmd
|
||||||
}
|
}
|
||||||
|
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
21
windev.ps1
21
windev.ps1
@ -12,6 +12,27 @@
|
|||||||
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 = "irm christitus.com/windev | iex"
|
||||||
|
|
||||||
|
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) {
|
||||||
|
"pwsh"
|
||||||
|
} else {
|
||||||
|
"powershell"
|
||||||
|
}
|
||||||
|
|
||||||
|
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) {
|
||||||
|
"wt"
|
||||||
|
} 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