pytorch/.github/scripts/kill_active_ssh_sessions.ps1
Eli Uriegas 865d127a66 .github: Enable with-ssh for Windows (#63440)
Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63440

Signed-off-by: Eli Uriegas <eliuriegas@fb.com>

Test Plan: Imported from OSS

Reviewed By: janeyx99

Differential Revision: D30521460

Pulled By: seemethere

fbshipit-source-id: e987e170e73fb4f9d9f024bed0e58404ed206848
2021-08-24 14:14:27 -07:00

12 lines
261 B
PowerShell

function Get-SSH-Sessions {
Get-Process sshd -IncludeUserName |
Where-Object UserName -notLike "*SYSTEM*" |
Select-Object Id
}
$runningSessions = Get-SSH-Sessions
foreach ($session in $runningSessions) {
Stop-Process -id $session.Id
}