Show RDP connection properties

This SBA will check the event logs and report the negotiated RDP version.

Version: 1.5.13
Created: 2018-11-22T00:15:04.27
Modified: 2018-11-27T02:23:26.553
Creator: mc
Downloads: 66
Tags:
The Script Copy Script Copied to clipboard

<# RDP session - connection properties #>

$ErrorActionPreference = “SilentlyContinue” # prevent error display

# get the rdp-tcp#
$session=$args[0]
#$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: https://dille.name/blog/2014/11/07/displaying-rds-event-log-messages-with-powershell/ https://4sysops.com/archives/search-the-event-log-with-the-get-winevent-powershell-cmdlet/ #>

START YOUR TRIAL

Get Your Download Link

Gain access to ControlUp from your PC. Register and get a link to start your Free Trial.