mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2024-11-14 14:45:52 -06:00
admin titus version
This commit is contained in:
parent
b0d54e41ad
commit
ae57539640
@ -44,12 +44,23 @@ $sync.version = "#{replaceme}"
|
|||||||
$sync.configs = @{}
|
$sync.configs = @{}
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
|
||||||
# If script isn't running as admin, show error message and quit
|
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||||
If (([Security.Principal.WindowsIdentity]::GetCurrent()).Owner.Value -ne "S-1-5-32-544") {
|
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
|
||||||
Write-Host "===========================================" -Foregroundcolor Red
|
|
||||||
Write-Host "-- Scripts must be run as Administrator ---" -Foregroundcolor Red
|
$wtInstalled = Get-Command wt.exe -ErrorAction SilentlyContinue
|
||||||
Write-Host "-- Right-Click Start -> Terminal(Admin) ---" -Foregroundcolor Red
|
$pwshInstalled = Get-Command pwsh -ErrorAction SilentlyContinue
|
||||||
Write-Host "===========================================" -Foregroundcolor Red
|
if ($pwshInstalled) {
|
||||||
|
$powershellcmd = "pwsh"
|
||||||
|
} else {
|
||||||
|
$powershellcmd = "powershell"
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($wtInstalled) {
|
||||||
|
Start-Process wt.exe -ArgumentList "new-tab $powershellcmd -ExecutionPolicy Bypass -Command `"irm https://christitus.com/win | iex`"" -Verb RunAs
|
||||||
|
} else {
|
||||||
|
Start-Process $powershellcmd -ArgumentList "-ExecutionPolicy Bypass -Command `"irm https://christitus.com/win | iex`"" -Verb RunAs
|
||||||
|
}
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user