if (Test-Path ./test-server.pid) { $sID = Get-Item -Path ./test-server.pid | Get-Content -Tail 1 if (Get-Process -Id $sID -ErrorAction SilentlyContinue) { Stop-Process -Id $sID } Remove-Item "./test-server.pid" } else { Write-Output "Couldn't find running server to stop." }