This commit is contained in:
zoicware
2025-06-08 15:53:14 -04:00
committed by GitHub
parent 137785384c
commit 6c29ff836e

View File

@@ -5,7 +5,12 @@ If (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]:
function Run-Trusted([String]$command) {
Stop-Service -Name TrustedInstaller -Force -ErrorAction SilentlyContinue
try {
Stop-Service -Name TrustedInstaller -Force -ErrorAction Stop -WarningAction Stop
}
catch {
taskkill /im trustedinstaller.exe /f >$null
}
#get bin path to revert later
$service = Get-WmiObject -Class Win32_Service -Filter "Name='TrustedInstaller'"
$DefaultBinPath = $service.PathName
@@ -18,8 +23,13 @@ function Run-Trusted([String]$command) {
sc.exe start TrustedInstaller | Out-Null
#set bin back to default
sc.exe config TrustedInstaller binpath= "`"$DefaultBinPath`"" | Out-Null
Stop-Service -Name TrustedInstaller -Force -ErrorAction SilentlyContinue
try {
Stop-Service -Name TrustedInstaller -Force -ErrorAction Stop -WarningAction Stop
}
catch {
taskkill /im trustedinstaller.exe /f >$null
}
}
function Write-Status {