Stop-ADUserRDPSessions
SYNOPSIS
Terminate RDP sessions for a specified Active Directory user.
SYNTAX
DESCRIPTION
This function identifies and terminates Remote Desktop Protocol (RDP) sessions for a specified Active Directory user. It can target all sessions or only disconnected sessions and supports forced termination if required.
EXAMPLES
EXAMPLE 1
Terminates all RDP sessions for the user "johndoe".
EXAMPLE 2
Terminates only disconnected RDP sessions for the user "johndoe".
EXAMPLE 3
Forcefully terminates all RDP sessions for the user "johndoe".
PARAMETERS
-Identity
The identity of the user whose RDP sessions should be terminated. Accepts DistinguishedName, ObjectSID, sAMAccountName, or UserPrincipalName.
Type: String
Parameter Sets: (All)
Aliases: DN, DistinguishedName, ObjectSID, sAMAccountName, UserPrincipalName
Required: True
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False
-DisconnectedOnly
A switch to terminate only disconnected RDP sessions.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: 2
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Force
A switch to forcefully terminate the RDP sessions.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.