<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Remote Desktop on Blog of Jérémie Litzler</title><link>https://iamjeremie.me/tags/remote-desktop/</link><description>Recent content in Remote Desktop on Blog of Jérémie Litzler</description><generator>Hugo -- gohugo.io</generator><language>en</language><lastBuildDate>Wed, 21 Oct 2026 00:00:00 +0000</lastBuildDate><atom:link href="https://iamjeremie.me/tags/remote-desktop/index.xml" rel="self" type="application/rss+xml"/><item><title>Log Off Users on Windows Server Core</title><link>https://iamjeremie.me/post/2026-10/log-off-users-on-windows-server-core/</link><pubDate>Wed, 21 Oct 2026 00:00:00 +0000</pubDate><guid>https://iamjeremie.me/post/2026-10/log-off-users-on-windows-server-core/</guid><description>&lt;img src="https://iamjeremie.me/post/2026-10/log-off-users-on-windows-server-core/2026-10-21-a-series-of-red-padlocks-attached-to-a-stone-wall.jpg" alt="Featured image of post Log Off Users on Windows Server Core" /&gt;&lt;p&gt;I have the habit of changing my password once a month instead of waiting for the 90-day limit. But somehow, it has caused me some headaches at work: my Windows account kept getting locked, very often.&lt;/p&gt;
&lt;p&gt;It turned out that I was still connected to several remote VMs, and they kept trying to log me in with an old password. Each failed attempt counted toward the lockout.&lt;/p&gt;
&lt;p&gt;On a Windows VM with a desktop, logging off a user is easy. You open the Task Manager, go to the &lt;strong&gt;Users&lt;/strong&gt; tab, right-click the session and choose &lt;strong&gt;Sign off&lt;/strong&gt;. But what about Windows Server Core, which has no Task Manager UI to click through? This short tutorial answers that.&lt;/p&gt;
&lt;h2 id="list-the-active-sessions"&gt;&lt;a href="#list-the-active-sessions" class="header-anchor"&gt;&lt;/a&gt;List the Active Sessions
&lt;/h2&gt;&lt;p&gt;Open a PowerShell prompt on the target server (Choice &amp;ldquo;15&amp;rdquo;) and run:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;query&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The short form &lt;code&gt;quser&lt;/code&gt; works too. Microsoft&amp;rsquo;s documentation describes it as the command that &amp;ldquo;displays information about user sessions on a Remote Desktop Session Host server&amp;rdquo;, and it returns the user name, the session name, the session ID, the state, the idle time and the logon time.&lt;/p&gt;
&lt;p&gt;The output looks like this:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;span class="lnt"&gt;2
&lt;/span&gt;&lt;span class="lnt"&gt;3
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-plaintext" data-lang="plaintext"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; USERNAME SESSIONNAME ID STATE IDLE TIME LOGON TIME
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; jermiel rdp-tcp#0 2 Active . 10/19/2026 9:12 AM
&lt;/span&gt;&lt;/span&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt; alext 3 Disc 1:05 10/19/2026 8:40 AM
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;A &lt;code&gt;&amp;gt;&lt;/code&gt; symbol is displayed before the current session, which helps you avoid cutting off the branch you are sitting on.&lt;/p&gt;
&lt;p&gt;If you are not on the server itself, you can query it remotely:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;quser&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="n"&gt;SERVERNAME&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Notice the &lt;code&gt;Disc&lt;/code&gt; state on the second line. A disconnected session is exactly what bit me: the session is gone from your screen, but it is still alive on the VM and still holds your old credentials.&lt;/p&gt;
&lt;h2 id="log-off-one-of-them"&gt;&lt;a href="#log-off-one-of-them" class="header-anchor"&gt;&lt;/a&gt;Log Off One of Them
&lt;/h2&gt;&lt;p&gt;The &lt;code&gt;logoff&lt;/code&gt; command takes the session ID, the number in the &lt;code&gt;ID&lt;/code&gt; column, not the user name:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;logoff&lt;/span&gt; &lt;span class="mf"&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Against a remote server, add the same &lt;code&gt;/server&lt;/code&gt; parameter:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;logoff&lt;/span&gt; &lt;span class="mf"&gt;3&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt;&lt;span class="n"&gt;server&lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="n"&gt;SERVERNAME&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;Two remarks from the documentation are worth keeping in mind. After a log off, all processes of that session end and the session is deleted from the server, so unsaved data is lost. And you need the Full Control permission to log off users other than yourself. Microsoft even suggests warning the user with the &lt;code&gt;msg&lt;/code&gt; command before doing so.&lt;/p&gt;
&lt;h2 id="when-the-session-does-not-go-away"&gt;&lt;a href="#when-the-session-does-not-go-away" class="header-anchor"&gt;&lt;/a&gt;When the Session Does Not Go Away
&lt;/h2&gt;&lt;p&gt;Sometimes &lt;code&gt;logoff&lt;/code&gt; hangs on a session that is stuck. In that case, reset it:&lt;/p&gt;
&lt;div class="highlight"&gt;&lt;div class="chroma"&gt;
&lt;table class="lntable"&gt;&lt;tr&gt;&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code&gt;&lt;span class="lnt"&gt;1
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;
&lt;td class="lntd"&gt;
&lt;pre tabindex="0" class="chroma"&gt;&lt;code class="language-powershell" data-lang="powershell"&gt;&lt;span class="line"&gt;&lt;span class="cl"&gt;&lt;span class="n"&gt;rwinsta&lt;/span&gt; &lt;span class="mf"&gt;3&lt;/span&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;p&gt;The long form &lt;code&gt;reset session 3&lt;/code&gt; does the same. Be aware that it is brutal, and anything unsaved in that session is lost.&lt;/p&gt;
&lt;p&gt;You may also read about the &lt;code&gt;Get-RDUserSession&lt;/code&gt; and &lt;code&gt;Invoke-RDUserLogoff&lt;/code&gt; cmdlets. They only exist if the Remote Desktop Services role and its module are installed, which is not the case by default on Server Core. The two classic commands above work everywhere.&lt;/p&gt;
&lt;h2 id="conclusion"&gt;&lt;a href="#conclusion" class="header-anchor"&gt;&lt;/a&gt;Conclusion
&lt;/h2&gt;&lt;p&gt;A monthly password change is a good habit, but every forgotten session on a remote VM is a small time bomb that keeps retrying the old one. Now that I know &lt;code&gt;quser&lt;/code&gt; and &lt;code&gt;logoff&lt;/code&gt; work as well on Server Core as the Task Manager does elsewhere, cleaning up after a password change takes seconds, and my account stays unlocked.&lt;/p&gt;
&lt;h2 id="references"&gt;&lt;a href="#references" class="header-anchor"&gt;&lt;/a&gt;References
&lt;/h2&gt;&lt;ul&gt;
&lt;li&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/query-user" target="_blank" rel="noopener"&gt;query user, Microsoft Learn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a class="link" href="https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/logoff" target="_blank" rel="noopener"&gt;logoff, Microsoft Learn&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you liked this article…&lt;/p&gt;
&lt;div class="jli-notice jli-notice-tip" id="Follow me" &gt;
 &lt;p class="jli-notice-title"&gt;Follow me&lt;/p&gt;&lt;p&gt;Thanks for reading this article. Make sure to &lt;a class="link" href="https://x.com/LitzlerJeremie" target="_blank" rel="noopener"&gt;follow me on X&lt;/a&gt;, &lt;a class="link" href="https://iamjeremie.substack.com/" target="_blank" rel="noopener"&gt;subscribe to my Substack publication&lt;/a&gt; and bookmark my blog to read more in the future.&lt;/p&gt;&lt;/div&gt;
&lt;p&gt;Credit: Photo by Diana on Pexels (&lt;code&gt;https://www.pexels.com/photo/close-up-of-red-padlocks-in-stone-wall-35908540/&lt;/code&gt;).&lt;/p&gt;</description></item></channel></rss>