Skip to content

Instantly share code, notes, and snippets.

@scvnc
Created April 9, 2021 14:47
Show Gist options
  • Save scvnc/0cfb39c10bb92df235ffc7918729cbae to your computer and use it in GitHub Desktop.
Save scvnc/0cfb39c10bb92df235ffc7918729cbae to your computer and use it in GitHub Desktop.
Kill some background processes so that vanguard maybe doesnt kick me
$processes = (
"Dropbox*",
"DbxSvc.exe",
"EpicGamesLauncher.exe",
"boinc*",
"OneDrive.exe",
"mDNSResponder.exe",
"Lightshot.exe",
"MoUsoCoreWorker.exe",
"PnkBstrA.exe",
"YourPhone.exe",
"RuntimeBroker.exe",
"FAHClient.exe",
"EpocCamService.exe",
"GoogleCrashHandler*",
"mullvad-daemon.exe",
"OriginWebHelperService.exe"
);
# Hunk of code to make this script run as administrator
if (-Not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] 'Administrator')) {
if ([int](Get-CimInstance -Class Win32_OperatingSystem | Select-Object -ExpandProperty BuildNumber) -ge 6000) {
$CommandLine = "-File `"" + $MyInvocation.MyCommand.Path + "`" " + $MyInvocation.UnboundArguments
Start-Process -FilePath PowerShell.exe -Verb Runas -ArgumentList $CommandLine
Exit
}
}
# Ask process to close, gently.
foreach ($p in $processes) {
taskkill /IM $p
}
# Kill each process if still remain.
foreach ($p in $processes) {
taskkill /F /IM $p
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment