Skip to content

Instantly share code, notes, and snippets.

@willryan
Last active August 29, 2015 14:13
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 willryan/3e6af7565fba09fdadd4 to your computer and use it in GitHub Desktop.
Save willryan/3e6af7565fba09fdadd4 to your computer and use it in GitHub Desktop.
Stopping IIS Express for a project
foreach($proc in (ps | Where { $_.name -like "iisexpress"} )) {
$iisid = $proc.Id
$iis = Get-WmiObject Win32_Process -filter "ProcessId=$iisid" | Where-Object { $_.CommandLine -like "*MyProjectName*" } | Select-Object -first 1
if($iis) {
stop-process -force $iis.ProcessId
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment