Disconnect-RDUser
Disconnect-RDUser
Disconnects a user from a session that runs on a remote server.
Syntax
Parameter Set: Default
Disconnect-RDUser [-HostServer] <String> [-UnifiedSessionID] <Int32> [-Force] [ <CommonParameters>]
Detailed 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.
Parameters
-Force
Disconnects the user from a session on the remote server without prompting the user for confirmation.
Aliases |
none |
Required? |
false |
Position? |
named |
Default Value |
none |
Accept Pipeline Input? |
false |
Accept Wildcard Characters? |
false |
-HostServer<String>
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.
Aliases |
none |
Required? |
true |
Position? |
1 |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
-UnifiedSessionID<Int32>
Provides the unique ID for the session. Use the Get-RDUserSession cmdlet to retrieve the user session ID.
Aliases |
none |
Required? |
true |
Position? |
2 |
Default Value |
none |
Accept Pipeline Input? |
True (ByPropertyName) |
Accept Wildcard Characters? |
false |
<CommonParameters>
This cmdlet supports the common parameters: -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutBuffer, and -OutVariable. For more information, see about_CommonParameters (https://go.microsoft.com/fwlink/p/?LinkID=113216).
Inputs
The input type is the type of the objects that you can pipe to the cmdlet.
Outputs
The output type is the type of the objects that the cmdlet emits.
- System.Object
Examples
Example 1: Disconnect a User from a session on an RD Session Host Server
This command disconnects the user connected to session 2 on the host server sessionhost.contoso.com.
PS C:\> Disconnect-RDUser -HostServer sessionhost.contoso.com -UnifiedSessionID 2