PoshCode Archive  Artifact [014e9c3aed]

Artifact 014e9c3aedb816253b3471a3c3bca9c445e54fc97479f4736b5985a6369d9439:

  • File kills-trustedinstaller.ps1 — part of check-in [1c498e0039] at 2018-06-10 14:10:55 on branch trunk — kills trustedinstaller (user: LunaHex size: 1050)

# encoding: ascii
# api: powershell
# title:  
# description: kills trustedinstaller
# version: 0.1
# type: function
# author: LunaHex
# license: CC0
# x-poshcode-id: 6227
# x-archived: 2016-08-26T03:50:02
# x-published: 2016-02-19T21:18:00
#
#
function killItWithFire {
  $TrustedInstallerProcess = Get-Process -ProcessName trustedinstaller
  if($TrustedInstallerProcess){
    Write-Host -ForegroundColor GREEN "TrustedInstaller process is running, killing it now."
    Stop-Process $TrustedInstallerProcess.Id -Force
  } else {
    Write-Host "TrustedInstaller process is not running."
  }
  $TrustedInstallerService = Get-Service trustedinstaller
  if($TrustedInstallerService.status -eq "Running"){
    Write-Host -ForegroundColor GREEN "TrustedInstaller service is running, stopping it now."
    Set-Service $TrustedInstallerService.name -Status stopped
  }
  Write-Host -ForegroundColor GREEN "Disabling TrustedInstaller service."
  Set-Service $TrustedInstallerService.name -StartupType Disabled
}
killItWithFire