<< Back to Script Library

Show RDP connection properties

This SBA will check the event logs and report the negotiated RDP version.
Version: 1.5.13
Created: 2018-11-22
Modified: 2018-11-27
Creator: mc
Downloads: 74
Tags: rdp rds
The Script Copy Script Copied to clipboard
<# RDP session - connection properties   #>

$ErrorActionPreference = "SilentlyContinue"         # prevent error display

# get the rdp-tcp#
#$session="RDP-Tcp#9" # Example
$rdpSession="Connection $session created"    # Build the string to search to find the ActivityID

#Get the ActivityID for that RDP session
$CorrelationId=(Get-WinEvent Microsoft-Windows-RemoteDesktopServices-RdpCoreTS/Operational `
             | Where-Object -Property Message -Match $rdpSession )[0].ActivityID

if($error.count -ge 1) {                                        # if previous command errored...
     Write-host "Required RDP log not found"
     exit                                                                   # Bailing out if the RDP 8+ log not found

Get-WinEvent Microsoft-Windows-RemoteDesktopServices-RdpCoreTS/Operational `
             | ?{$_.ActivityID -eq $CorrelationId} `
             | Where-Object -Property Message -Match "client operating system type|Microsoft::Windows::RDS::Graphics|client supports version|Client not supported" `
             |Sort-Object -Property id -Descending   | ft id, Message -AutoSize

<#  Inspired by: