COMMAND EVERYTHING.
Disconnects a user from a session that runs on a remote server.
PowerShell · Risk: High · Documentation VerifiedLast verified: 2026-10-26
Microsoft RemoteDesktop reference: Disconnects a user from a session that runs on a remote server. The syntax and selected example below are adapted from the pinned Windows Server 2025 reference. Module availability, target configuration and delegated permissions determine whether it can run in your environment. Documentation and parameter text: Microsoft, CC BY 4.0; formatting adapted by Cmdlet World. No execution testing is claimed.
Disconnect-RDUser [-HostServer] <String> [-UnifiedSessionID] <Int32> [-Force] [<CommonParameters>]Copied 0 timesUse an account with the target resource permissions documented for Disconnect-RDUser. Modifying administrative cmdlets may require elevation or delegated administration. This catalog does not assert that ordinary users can execute the command.
Windows / RemoteDesktop · Windows Server 2025 documentation; feature/module prerequisites apply
-Force-HostServer (required)-UnifiedSessionID (required)Windows with the RemoteDesktop module and the Windows feature or management tools that provide it. Confirm target connectivity and version compatibility using the linked Microsoft reference.
This cmdlet changes system state. Review every target and parameter in the official reference, test outside production, and prepare an appropriate backup or rollback. Do not execute the example automatically.
Disconnect-RDUser -HostServer sessionhost.contoso.com -UnifiedSessionID 2This command disconnects the user connected to session 2 on the host server sessionhost.contoso.com. Source: Microsoft, CC BY 4.0; transcript prompt/output removed. This example was not executed.
Sign in to keep your own command reference lists.
Explain or customize this command with AI