Created
February 1, 2024 15:28
-
-
Save Aaronontheweb/1589836ea5d2e3ac5f348399b3fc8c80 to your computer and use it in GitHub Desktop.
Cleanup Script for Azure Functions Local Debugging
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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