{"id":2279,"date":"2022-08-04T18:36:34","date_gmt":"2022-08-04T16:36:34","guid":{"rendered":"https:\/\/itsimple.info\/?p=2279"},"modified":"2022-08-04T18:40:52","modified_gmt":"2022-08-04T16:40:52","slug":"remote-desktop-service-or-rdp-access-log","status":"publish","type":"post","link":"https:\/\/itsimple.info\/?p=2279","title":{"rendered":"Remote Desktop Service Or RDP access LOG"},"content":{"rendered":"\n<p>The way to see how was connected to windows server through RDP is the EventLog at this location:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"413\" height=\"397\" data-id=\"2280\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2022\/08\/RDP-Access-log.jpg\" alt=\"\" class=\"wp-image-2280\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2022\/08\/RDP-Access-log.jpg 413w, https:\/\/itsimple.info\/wp-content\/uploads\/2022\/08\/RDP-Access-log-300x288.jpg 300w\" sizes=\"auto, (max-width: 413px) 100vw, 413px\" \/><\/figure>\n<\/figure>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-default is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"400\" height=\"105\" data-id=\"2282\" src=\"https:\/\/itsimple.info\/wp-content\/uploads\/2022\/08\/RDP-Access-log-2.jpg\" alt=\"\" class=\"wp-image-2282\" srcset=\"https:\/\/itsimple.info\/wp-content\/uploads\/2022\/08\/RDP-Access-log-2.jpg 400w, https:\/\/itsimple.info\/wp-content\/uploads\/2022\/08\/RDP-Access-log-2-300x79.jpg 300w\" sizes=\"auto, (max-width: 400px) 100vw, 400px\" \/><\/figure>\n<\/figure>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h2_2\">Getting Remote Desktop Login History with PowerShell<\/h2>\n\n\n\n<p>Here is a short PowerShell script that lists the history of all RDP connections for the current day from the terminal RDS server event logs. The resulting table shows the connection time, the client\u2019s IP address (DNS computername), and the remote user name (if necessary, you can include other LogonTypes in the report).<\/p>\n\n\n\n<p><code>Get-EventLog -LogName Security -after (Get-date -hour 0 -minute 0 -second 0)| ?{(4624,4778) -contains $_.EventID -and $_.Message -match 'logon type:\\s+(10)\\s'}| %{<br>(new-object -Type PSObject -Property @{<br>TimeGenerated = $_.TimeGenerated<br>ClientIP = $_.Message -replace '(?smi).*Source Network Address:\\s+([^\\s]+)\\s+.*','$1'<br>UserName = $_.Message -replace '(?smi).*\\s\\sAccount Name:\\s+([^\\s]+)\\s+.*','$1'<br>UserDomain = $_.Message -replace '(?smi).*\\s\\sAccount Domain:\\s+([^\\s]+)\\s+.*','$1'<br>LogonType = $_.Message -replace '(?smi).*Logon Type:\\s+([^\\s]+)\\s+.*','$1'<br>})<br>} | sort TimeGenerated -Descending | Select TimeGenerated, ClientIP `<br>, @{N='Username';E={'{0}\\{1}' -f $_.UserDomain,$_.UserName}} `<br>, @{N='LogType';E={<br>switch ($_.LogonType) {<br>2 {'Interactive - local logon'}<br>3 {'Network connection to shared folder)'}<br>4 {'Batch'}<br>5 {'Service'}<br>7 {'Unlock (after screensaver)'}<br>8 {'NetworkCleartext'}<br>9 {'NewCredentials (local impersonation process under existing connection)'}<br>10 {'RDP'}<br>11 {'CachedInteractive'}<br>default {\"LogType Not Recognised: $($_.LogonType)\"}<br>}<br>}}<\/code><\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/woshub.com\/wp-content\/uploads\/2019\/07\/powershell-list-todays-rdp-logons-with-an-ip-and.png\" alt=\"powershell: list todays rdp logons with an ip and username\" class=\"wp-image-5698\"\/><\/figure>\n\n\n\n<figure class=\"wp-block-pullquote has-vivid-green-cyan-color has-text-color has-small-font-size\"><blockquote><p>Good Luck<\/p><\/blockquote><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>The way to see how was connected to windows server through RDP is the EventLog at this location: Getting Remote Desktop Login History with PowerShell Here is a short PowerShell script that lists the history of all RDP connections for the current day from the terminal RDS server event logs. The resulting table shows the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,12,14,15],"tags":[],"class_list":["post-2279","post","type-post","status-publish","format-standard","hentry","category-operating-systems","category-tutorials","category-windows","category-windows-server"],"_links":{"self":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2279","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2279"}],"version-history":[{"count":0,"href":"https:\/\/itsimple.info\/index.php?rest_route=\/wp\/v2\/posts\/2279\/revisions"}],"wp:attachment":[{"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2279"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2279"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itsimple.info\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2279"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}