Edit

Share via


Disconnect-RDUser

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

Syntax

Default (Default)

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.

Parameter properties

Type:SwitchParameter
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:Named
Mandatory:False
Value from pipeline:False
Value from pipeline by property name:False
Value from remaining arguments: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.

Parameter properties

Type:String
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:0
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

-UnifiedSessionID

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

Parameter properties

Type:Int32
Default value:None
Supports wildcards:False
DontShow:False

Parameter sets

(All)
Position:1
Mandatory:True
Value from pipeline:False
Value from pipeline by property name:True
Value from remaining arguments:False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutBuffer, -OutVariable, -PipelineVariable, -ProgressAction, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

Outputs

Object