The Invoke-RdsUserSessionLogoff logs off a user their current active session running on the specified session host. Since the user is logged off, all applications will be terminated and there is a potential for data to be lost if the user or applications have not saved opened files.
Examples
Example 1: Log off a user by providing all required information
This command logs off the user on the specified session host associated with the provided session ID. This command requires you to have looked up the user session previously to provide all of the required information. By running the Invoke-RdsUserSessionLogoff cmdlet without the NoUserPrompt switch, you will be asked to confirm to log off the user.
Example 2: Log off a user by searching for their user session
This command uses the Get-RdsUserSession cmdlet to search for the specific user's session, then pipes it into the Invoke-RdsUserSessionLogoff cmdlet to log off the user. By running the Invoke-RdsUserSessionLogoff cmdlet with the NoUserPrompt switch, you will not receive any additional prompt to confirm to log off the user.
Parameters
-Force
The switch indicating that you would like to log off the user and remove the session from the database, even if the service cannot reach the session host.
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
-HostPoolName
The name of the host pool.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
1
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
True
Value from remaining arguments:
False
-NoUserPrompt
The switch indicating that you would like to log off the user without any additional 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
-SessionHostName
The name of the session host.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
2
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
True
Value from remaining arguments:
False
-SessionId
The session ID correlating to the user you want to log off.
Parameter properties
Type:
Int32
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
3
Mandatory:
True
Value from pipeline:
True
Value from pipeline by property name:
True
Value from remaining arguments:
False
-TenantName
The name of the tenant.
Parameter properties
Type:
String
Default value:
None
Supports wildcards:
False
DontShow:
False
Parameter sets
(All)
Position:
0
Mandatory:
True
Value from pipeline:
True
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.