add proper method to launch correct script

This commit is contained in:
MyDrift 2024-08-21 21:48:27 +02:00
parent ae57539640
commit a6d4d47a88

View File

@ -48,17 +48,17 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
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 $wtInstalled = Get-Command wt.exe -ErrorAction SilentlyContinue
$pwshInstalled = Get-Command pwsh -ErrorAction SilentlyContinue $pwshInstalled = Get-Command pwsh -ErrorAction SilentlyContinue
if ($pwshInstalled) { if ($pwshInstalled) {
$powershellcmd = "pwsh" $powershellcmd = "pwsh"
} else { } else {
$powershellcmd = "powershell" $powershellcmd = "powershell"
} }
if ($wtInstalled) { if ($wtInstalled) {
Start-Process wt.exe -ArgumentList "new-tab $powershellcmd -ExecutionPolicy Bypass -Command `"irm https://christitus.com/win | iex`"" -Verb RunAs Start-Process wt.exe -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -File $PSScriptRoot\winutil.ps1 -Run" -Verb RunAs
} else { } else {
Start-Process $powershellcmd -ArgumentList "-ExecutionPolicy Bypass -Command `"irm https://christitus.com/win | iex`"" -Verb RunAs Start-Process $powershellcmd -ArgumentList "-ExecutionPolicy Bypass -NoProfile -File $PSScriptRoot\\winutil.ps1 -Run" -Verb RunAs
} }
break break
@ -66,4 +66,4 @@ if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
# Set PowerShell window title # Set PowerShell window title
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)" $Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)"
clear-host clear-host