Advertisement
guyrleech

Get AVD Short Path Negotations

Oct 21st, 2024 (edited)
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PowerShell 1.15 KB | Software | 0 0
  1. ## Get AVD events which may include RDP shortpath negotiation
  2. ## Some lines will have a "json" property which includes more detail about the shortpath negotation
  3. ## Work in progress
  4.  
  5. $boot=(gcim Win32_OperatingSystem).LastBootUpTime ;Get-WinEvent -oldest -FilterHashtable @{ ProviderName = 'Microsoft.RDInfra.RDAgent.EtwReader.RdpConnectionCheckpointParser'; id = 0 ; Starttime = $boot }|where message -match '^received event:\s*<Event\s+(.*)/>$'|select  timecreated,@{n='Event';e={$matches[1]}} -PipelineVariable line |% {[hashtable]$h=@{ Time = $line.timecreated}; [regex]::Matches( $line.Event , '\s?([^=]+)=\s*"([^"]*)"\s?' ) |Select -Expand Captures| %{ if( $_.groups[1].value -ieq 'json' ) { try { $item = $_ ; $value = $item.groups[2].value -replace '&quot;' ,'"' |convertfrom-json } catch {$value = "$($item.groups[2].value) }" -replace '&quot;' ,'"' |convertfrom-json } } elseif( $_.groups[1].value -ieq 'msec' ) { $value = $boot.AddMilliseconds( $_.groups[2].value ) } else { $value = $_.groups[2].value } ; $h.Add( $_.groups[1].Value , $value )  };[pscustomobject]$h } |select -Exclude message -Property *,@{n='message';e={$_.message -replace '&apos;' , ''''}} -ea 0
Tags: avd
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement