{"id":138,"date":"2019-01-17T02:21:06","date_gmt":"2019-01-17T07:21:06","guid":{"rendered":"http:\/\/itblog.ldlnet.net\/?p=138"},"modified":"2019-01-17T02:21:06","modified_gmt":"2019-01-17T07:21:06","slug":"how-to-log-off-a-rdp-session-remotely","status":"publish","type":"post","link":"https:\/\/itblog.ldlnet.net\/index.php\/2019\/01\/17\/how-to-log-off-a-rdp-session-remotely\/","title":{"rendered":"How to log off a RDP session remotely."},"content":{"rendered":"\n<p>Have you ever tried to logon to a Remote Desktop session on a Windows Server and you get stuck on the following screen?<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img loading=\"lazy\" decoding=\"async\" width=\"322\" height=\"254\" src=\"http:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/01\/logoffstuck.png\" alt=\"\" class=\"wp-image-139\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/01\/logoffstuck.png 322w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/01\/logoffstuck-300x237.png 300w\" sizes=\"auto, (max-width: 322px) 100vw, 322px\" \/><figcaption>Stuck Logging Off<\/figcaption><\/figure><\/div>\n\n\n\n<p>Well, here is a simple way you can remotely kill that RDP session through PowerShell so that you can logon to the server again&#8230;<\/p>\n\n\n<pre class=\"lang:PowerShell\" title=\"Get the RDP sessions on a server\">qwinsta \/server:ServerName<\/pre>\n\n\n\n<p class=\"has-small-font-size\"><strong>Sample Output:<\/strong><\/p>\n\n\n\n<figure class=\"wp-block-image is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/01\/qwinsta.png\" alt=\"\" class=\"wp-image-141\" width=\"661\" height=\"122\" srcset=\"https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/01\/qwinsta.png 541w, https:\/\/itblog.ldlnet.net\/wp-content\/uploads\/2019\/01\/qwinsta-300x55.png 300w\" sizes=\"auto, (max-width: 661px) 100vw, 661px\" \/><figcaption>Output from qwinsta command&#8230;<\/figcaption><\/figure>\n\n\n\n<p>Once you get the session ID, you can run the following to kick off the user&#8217;s session completely so that you can log into the server again:<\/p>\n\n\n<pre class=\"lang:PowerShell\" title=\"Remove an RDP Session from a server\">rwinsta\u00a0SESSION_ID\u00a0\/SERVER:ServerName<\/pre>\n\n\n\n<p>Note: The session will be completely removed from RDP and anything running will be lost, but most of the time, you don&#8217;t have to worry about losing anything as the whole reason to lose the session is because you cannot logoff of it normally. <\/p>\n\n\n\n<p>Life is then good again as you can log into your RDP session.  Yay!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Have you ever tried to logon to a Remote Desktop session on a Windows Server and you get stuck on the following<\/p>\n<p class=\"link-more\"><a class=\"myButt \" href=\"https:\/\/itblog.ldlnet.net\/index.php\/2019\/01\/17\/how-to-log-off-a-rdp-session-remotely\/\">Read More<\/a><\/p>\n","protected":false},"author":1,"featured_media":139,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2,3,16],"tags":[15,8,55,56,20],"class_list":["post-138","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","category-powershell","category-windows","tag-cmdlet","tag-powershell","tag-rdp","tag-session","tag-windows","odd"],"_links":{"self":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/138","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/comments?post=138"}],"version-history":[{"count":3,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/138\/revisions"}],"predecessor-version":[{"id":143,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/posts\/138\/revisions\/143"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/media\/139"}],"wp:attachment":[{"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/media?parent=138"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/categories?post=138"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/itblog.ldlnet.net\/index.php\/wp-json\/wp\/v2\/tags?post=138"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}