Disconnect-RDUser

Disconnects a user from a session that runs on a remote server.

Syntax

Disconnect-RDUser
          [-HostServer] <String>
          [-UnifiedSessionID] <Int32>
          [-Force]
          [<CommonParameters>]

Description

The Disconnect-RDUser cmdlet disconnects a specified user from a session that runs on the remote server. All applications continue to run.

Use the Invoke-RDUserLogoff cmdlet to end a session and close running applications.

Use the Get-RDUserSessioncmdlet to retrieve the value for the user session ID. Because the user session ID is unique only within the context of a session host, a different session host server can share the same user session ID. The host server and session ID that you specify in this cmdlet uniquely identify a session within a deployment.

Examples

Example 1: Disconnect a User from a session on an RD Session Host Server

PS C:\> Disconnect-RDUser -HostServer sessionhost.contoso.com -UnifiedSessionID 2

This command disconnects the user connected to session 2 on the host server sessionhost.contoso.com.

Parameters

-Force

Forces the command to run without asking for user confirmation.

Type:SwitchParameter
Position:Named
Default value:None
Required:False
Accept pipeline input:False
Accept wildcard characters:False

-HostServer

Specifies the name of the server that hosts the session. For session collections the server name is the name of the Remote Desktop Session Host (RD Session Host) server. For virtual desktop collections the server name is the name of the Remote Desktop Virtualization Host (RD Virtualization Host) server.

Type:String
Position:0
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

-UnifiedSessionID

Provides the unique ID for the session. Use the Get-RDUserSession cmdlet to retrieve the user session ID.

Type:Int32
Position:1
Default value:None
Required:True
Accept pipeline input:True
Accept wildcard characters:False

Outputs

Object