Skip to content

Instantly share code, notes, and snippets.

@Aaronontheweb
Created February 1, 2024 15:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Aaronontheweb/1589836ea5d2e3ac5f348399b3fc8c80 to your computer and use it in GitHub Desktop.
Save Aaronontheweb/1589836ea5d2e3ac5f348399b3fc8c80 to your computer and use it in GitHub Desktop.
Cleanup Script for Azure Functions Local Debugging
$processNameContains = "func"
try {
# Get all processes where the name contains 'func'
$processesToKill = Get-Process | Where-Object { $_.ProcessName -like "*$processNameContains*" }
# Check if there are any processes to kill
if ($processesToKill) {
# Kill each process
foreach ($process in $processesToKill) {
$process | Stop-Process -Force
Write-Host "Killed process $($process.Id) - $($process.ProcessName)"
}
} else {
Write-Host "No processes found with name containing '$processNameContains'."
}
} catch {
Write-Host "Error: $_"
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment