Disconnect-RDUser
Updated: September 14, 2012
Applies To: Windows Server 2012
Disconnect-RDUser
Syntax
Parameter Set: __AllParameterSets Disconnect-RDUser [-HostServer] <String> [-UnifiedSessionID] <Int32> [-Force] [ <CommonParameters>]
Detailed Description
The Disconnect-RDUser cmdlet disconnects a specified user from a session running on the remote server. All applications continue to run. Use Invoke-RDUserLogoff to end a session and close running applications. Use Get-RDUserSession to retrieve the value for UnifiedSessionId. The UnifiedSessionID is unique only within a session host context, therefore a different session host server may share the same UnifiedSessionId value. The HostServer and UnifiedSessionId parameters used together uniquely identify a session within a deployment.
Parameters
-Force
|
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 hosting the session. This parameter is required. For session collections this is the name of the Remost Desktop Session Host (RD Session Host) server. For virtual desktop collections this 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. This parameter is required. Use the Get-RDUserSession cmdlet to retrieve this integer value.
|
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.
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 a Specified RD Session Host Server
This command disconnects the user connected to session 2, as specified by the value 2 by using the UnifiedSessionID parameter.
PS C:\> Disconnect-RDUser -HostServer sessionhost.contoso.com -UnifiedSessionID 2
Example 2: Duplicate Example
This command disconnects the user connected to session 2, as specified by the value 2 by using the UnifiedSessionID parameter.
PS C:\> Disconnect-RDUser -HostServer sessionhost.contoso.com -UnifiedSessionID 2
