Disconnect-PSSessionDescription. The Disconnect-PSSession cmdlet disconnects a PowerShell session ("PSSession"), such as one started by using the New-PSSession cmdlet, from the current session.Examples. This command disconnects the UpdateSession PSSession on the Server01 computer from the current session.Parameters. Outputs. The idle timeout determines how long the disconnected PSSession is maintained on the remote computer. When the timeout expires, the PSSession is deleted. Disconnected PSSessions are considered to be idle from the moment that they are disconnected, even if commands are running in the disconnected session.devops-collective-inc.gitbook.ioИзображение:devops-collective-inc.gitbook.ioThe Remove-PSSession cmdlet closes PowerShell sessions (PSSessions) in the current session. It stops any commands that are running in the PSSessions, ends the PSSession, and releases the resources that the PSSession was using.By default, Remote Desktop Services allows users to disconnect from a remote session without logging off and ending the session. When a session is in a disconnected state, running programs are kept active even though the user is no longer actively connected. To understand Remote Desktop Sessions
What does disconnect-pssession do in PowerShell?
The Disconnect-PSSession cmdlet disconnects a PowerShell session ("PSSession"), such as one started by using the New-PSSession cmdlet, from the current session. As a result, the PSSession is in a disconnected state.
What is idle timeout in disdisconnected pssessions?
Disconnected PSSessions are considered to be idle from the moment that they are disconnected, even if commands are running in the disconnected session. The default value for the idle timeout of a session is set by the value of the IdleTimeoutMs property of the session configuration.
What happens when you close a session in PowerShell?
Note that closing (disconnecting) a session does not terminate it. To destroy a PSSession, you can run the Remove-PSSession cmdlet. If you run Invoke-Command in synchronous mode (for instance, if you didn’t pass the ‑InDisconnectedSession switch), the corresponding session will automatically be removed after your command completes.
What happens when a session is disconnected from a remote computer?
The remote computer that maintains the session must be running and be connected to the network. Commands in a disconnected PSSession continue to run uninterrupted on the remote computer until the command completes or the output buffer fills.

Below are two helpful articles on a similar topic 👇
Why has my ADRs session ended?How do I know if Remote Desktop is enabled or disabled?