mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-15 17:30:37 -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)) {
|
||||
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
|
||||
|
||||
$wtInstalled = Get-Command wt.exe -ErrorAction SilentlyContinue
|
||||
$pwshInstalled = Get-Command pwsh -ErrorAction SilentlyContinue
|
||||
if ($pwshInstalled) {
|
||||
$powershellcmd = "pwsh"
|
||||
$script = if (Test-Path "$PSScriptRoot\winutil.ps1") {
|
||||
"$PSScriptRoot\winutil.ps1"
|
||||
} else {
|
||||
$powershellcmd = "powershell"
|
||||
"irm christitus.com/win | iex"
|
||||
}
|
||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) {
|
||||
"pwsh"
|
||||
} else {
|
||||
"powershell"
|
||||
}
|
||||
|
||||
if ($wtInstalled) {
|
||||
Start-Process wt.exe -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -File $PSScriptRoot\winutil.ps1 -Run" -Verb RunAs
|
||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) {
|
||||
"wt"
|
||||
} 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
|
||||
}
|
||||
|
21
windev.ps1
21
windev.ps1
@ -12,6 +12,27 @@
|
||||
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 Get-LatestRelease {
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user