{"id":91,"date":"2020-05-11T20:14:58","date_gmt":"2020-05-11T20:14:58","guid":{"rendered":"https:\/\/ramblings.gregconway.com\/?p=91"},"modified":"2020-05-11T20:19:08","modified_gmt":"2020-05-11T20:19:08","slug":"how-to-end-an-rdp-session-and-return-to-the-console-for-steam-in-one-way-or-another","status":"publish","type":"post","link":"https:\/\/ramblings.gregconway.com\/?p=91","title":{"rendered":"How to end an RDP session and return to the console (for Steam in one way or another!)"},"content":{"rendered":"<p>This quick script ends your current RDP session and returns your PC to the console.<\/p>\n<p>I&#8217;ve needed this a couple of times now, and they were both Steam-related! (plus not wanting to walk to the remote PC all the time! \ud83d\ude42<\/p>\n<p>Enter this in a bath file &#8220;logoff.bat&#8221; or similar &#8211;<\/p>\n<p>set MY_SESSION_ID=unknown<br \/>\nfor \/f &#8220;tokens=3-4&#8221; %%a in (&#8216;query session %username%&#8217;) do @if &#8220;%%b&#8221;==&#8221;Active&#8221; set MY_SESSION_ID=%%a<br \/>\nC:\\Windows\\System32\\tscon.exe %MY_SESSION_ID% \/dest:console \/v<\/p>\n<p>Run that batch file as an admistrator, whilst in an RDP session, and it will end your current RDP session returning your PC to the console!<\/p>\n<p>I had to walk to that PC a <strong>lot<\/strong> of times!!<\/p>\n<p>Sources &#8211;<\/p>\n<p>https:\/\/steamcommunity.com\/groups\/homestream\/discussions\/0\/540732889170346271\/<br \/>\nhttps:\/\/superuser.com\/questions\/303927\/how-can-i-retrieve-the-session-id-from-command-line<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This quick script ends your current RDP session and returns your PC to the console. I&#8217;ve needed this a couple of times now, and they were both Steam-related! (plus not wanting to walk to the remote PC all the time! &hellip; <a href=\"https:\/\/ramblings.gregconway.com\/?p=91\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[15],"tags":[],"class_list":["post-91","post","type-post","status-publish","format-standard","hentry","category-steam"],"_links":{"self":[{"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/posts\/91","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=91"}],"version-history":[{"count":2,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions"}],"predecessor-version":[{"id":93,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=\/wp\/v2\/posts\/91\/revisions\/93"}],"wp:attachment":[{"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=91"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=91"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ramblings.gregconway.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=91"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}