PowerShell Exit-PSSession Cmdlet
Hello Everyone
Welcome to CloudAffaire and this is Debjeet.
In the last blog post, we have discussed Enter-PSSession cmdlet in PowerShell.
https://cloudaffaire.com/powershell-enter-pssession-cmdlet/
In this blog post, we will discuss Exit-PSSession cmdlet in PowerShell. You can use Exit-PSSession cmdlet to exit an interactive session with a local or remote computer. You can also use the exit command to exit an interactive PSSession.
Exit-PSSession Cmdlet Syntax:
1 |
## Exit-PSSession [] |
Exit-PSSession Cmdlet Argument List:
NA
PowerShell Exit-PSSession Cmdlet:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
########################################## ## PowerShell | Cmdlet | Exit-PSSession ## ########################################## ## PowerShell Latest Version (5) ## Run PowerShell as admin ## create a new PSSession with a remote computer New-PSSession -ComputerName "System1" -Name "MyPsSession" ## get PSSession details Get-PSSession ## enter interactive PSSession with a remote computer Enter-PSSession -Name "MyPsSession" ## execute any command on a remote computer hostname ## exit interactive PSSession with a remote computer Exit-PSSession ## disconnect PSSession with a remote computer Disconnect-PSSession -Name "MyPsSession" Get-PSSession ## connect to a disconnected pssession with a remote computer Connect-PSSession -Name "MyPsSession" ## remove PSSession with a remote computer Remove-PSSession -Name "MyPsSession" |
Hope you have enjoyed this article. In the next blog post, we will discuss Disconnect-PSSession CmdLet in PowerShell.
To get more details on PowerShell, kindly follow below official documentation