darkoperator / Posh-SSH

PowerShell Module for automating tasks on remote systems using SSH
BSD 3-Clause "New" or "Revised" License
982 stars 227 forks source link

Terminate all sessions #446

Open breezytm opened 2 years ago

breezytm commented 2 years ago

With 2.3.0 I was able to write the terminate all my active sessions at the end of a script

#Disconnect all SFTP Sessions
Get-SFTPSession | % { Remove-SFTPSession -SessionId ($_.SessionId) } | Out-Null

I am in the process of updating the script to work with 3.0 and I can't for the life get the syntax right. Does anyone mind sharing how they would end all active sessions. I am out of ideas.

MVKozlov commented 2 years ago

Just try Get-SSHSession | Remove-SSHSession | Out-Null But GA v3.0 can lead to errors. Try to use latest from master branch with #432 merged

darkoperator commented 2 years ago

Will push a new version of 3.x tomorrow to ensure the fix is available.

On Mar 9, 2022, at 7:15 AM, Max Kozlov @.***> wrote:

Just try Get-SSHSession | Remove-SSHSession | Out-Null But GA v3.0 can lead to errors. Try to use latest from master branch with #432 https://github.com/darkoperator/Posh-SSH/pull/432 merged

— Reply to this email directly, view it on GitHub https://github.com/darkoperator/Posh-SSH/issues/446#issuecomment-1062814059, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD7IHUHA2DFWEH36OZRHQ3U7CB4LANCNFSM5QHFUNGQ. Triage notifications on the go with GitHub Mobile for iOS https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Android https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub. You are receiving this because you are subscribed to this thread.