This commit is contained in:
MyDrift 2024-08-23 12:49:51 +02:00
parent da173cc720
commit 5468b86898
2 changed files with 6 additions and 27 deletions

View File

@ -47,22 +47,10 @@ $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."
$script = if (Test-Path "$PSScriptRoot\winutil.ps1") { $script = if ($MyInvocation.MyCommand.Path) { "& '" + $MyInvocation.MyCommand.Path + "'" } else { "irm 'https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1' | iex"}
"$PSScriptRoot\winutil.ps1" $powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
} else { $processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
"irm christitus.com/win | iex"
}
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) {
"pwsh.exe"
} else {
"powershell.exe"
}
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) {
"wt.exe"
} else {
$powershellcmd
}
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs
break break

View File

@ -15,19 +15,10 @@
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."
$script = "irm christitus.com/windev | iex" $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 }
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) {
"pwsh.exe"
} else {
"powershell.exe"
}
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) {
"wt.exe"
} else {
$powershellcmd
}
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs
break break