<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	
	>
<channel>
	<title>
	Comments on: Get Logged In Users Using Powershell	</title>
	<atom:link href="https://thesysadminchannel.com/get-logged-in-users-using-powershell/feed/" rel="self" type="application/rss+xml" />
	<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/</link>
	<description>Documenting My Life as a System Administrator</description>
	<lastBuildDate>Wed, 18 Jun 2025 00:53:55 +0000</lastBuildDate>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.2</generator>
	<item>
		<title>
		By: Alex		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-43121</link>

		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Wed, 18 Jun 2025 00:53:55 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-43121</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-42365&quot;&gt;Paul&lt;/a&gt;.

Thanks Paul, I&#039;ll check it out.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-42365">Paul</a>.</p>
<p>Thanks Paul, I&#8217;ll check it out.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Paul		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-42365</link>

		<dc:creator><![CDATA[Paul]]></dc:creator>
		<pubDate>Mon, 02 Jun 2025 12:24:39 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-42365</guid>

					<description><![CDATA[Thanks for this, made a small script that uses the function to display users and log off the select users:
$servers = get-content $PSScriptRoot\servers.csv
$result = Get-loggedinUser -ComputerName $servers
$logoff = $result&#124;Out-GridView -PassThru -Title &quot;Select session(s) to logoff&quot;
Foreach ($session in $logoff){
    Write-host -ForegroundColor Green &quot;Logging off $($session.UserName) from server $($session.ComputerName)&quot;
    logoff /server $session.Computername $session.SessionId
}

Servers.csv should contain the servers you want to check, it is possible to use the script below to select the servers to be included:

$Date = (Get-Date).AddDays(-30)
$servers = Get-ADComputer -Filter &#039;OperatingSystem -like &quot;*Server*&quot; -and lastLogonTimestamp -gt $date&#039;-Properties operatingSystem
($servers &#124;Out-GridView -PassThru -Title &quot;Select server to view sessions for&quot;)&#124; select -ExpandProperty Name&#124;Set-Content $PSScriptRoot\servers.csv]]></description>
			<content:encoded><![CDATA[<p>Thanks for this, made a small script that uses the function to display users and log off the select users:<br />
$servers = get-content $PSScriptRoot\servers.csv<br />
$result = Get-loggedinUser -ComputerName $servers<br />
$logoff = $result|Out-GridView -PassThru -Title &#8220;Select session(s) to logoff&#8221;<br />
Foreach ($session in $logoff){<br />
    Write-host -ForegroundColor Green &#8220;Logging off $($session.UserName) from server $($session.ComputerName)&#8221;<br />
    logoff /server $session.Computername $session.SessionId<br />
}</p>
<p>Servers.csv should contain the servers you want to check, it is possible to use the script below to select the servers to be included:</p>
<p>$Date = (Get-Date).AddDays(-30)<br />
$servers = Get-ADComputer -Filter &#8216;OperatingSystem -like &#8220;*Server*&#8221; -and lastLogonTimestamp -gt $date&#8217;-Properties operatingSystem<br />
($servers |Out-GridView -PassThru -Title &#8220;Select server to view sessions for&#8221;)| select -ExpandProperty Name|Set-Content $PSScriptRoot\servers.csv</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Alex		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-41437</link>

		<dc:creator><![CDATA[Alex]]></dc:creator>
		<pubDate>Thu, 22 May 2025 19:38:54 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-41437</guid>

					<description><![CDATA[Paul, this script is great! I&#039;ve been using it for a couple years to query users on four servers.  Would there be a way to modify this script to not only return the username, but also their first and last names?  I can do first and last names through Get-ADUser but I can&#039;t see how to incorporate that with logged in computer info.  But thanks again for this script!]]></description>
			<content:encoded><![CDATA[<p>Paul, this script is great! I&#8217;ve been using it for a couple years to query users on four servers.  Would there be a way to modify this script to not only return the username, but also their first and last names?  I can do first and last names through Get-ADUser but I can&#8217;t see how to incorporate that with logged in computer info.  But thanks again for this script!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: nesh		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-15728</link>

		<dc:creator><![CDATA[nesh]]></dc:creator>
		<pubDate>Fri, 28 Jul 2023 19:56:56 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-15728</guid>

					<description><![CDATA[Hi Mr Paul, is it possible that when I run the script on server A, it automatically reads the logged-on server A&#039;s user and display it right away?]]></description>
			<content:encoded><![CDATA[<p>Hi Mr Paul, is it possible that when I run the script on server A, it automatically reads the logged-on server A&#8217;s user and display it right away?</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: R W		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-7767</link>

		<dc:creator><![CDATA[R W]]></dc:creator>
		<pubDate>Tue, 24 Jan 2023 19:57:57 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-7767</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-7703&quot;&gt;Paul Contreras&lt;/a&gt;.

Thanks for the response
I have a few other scripts that I use to generate html email reports with the output embedded in the body of the email and nicely formatted using ConvertToHtml and -Fragment.
I have used that along with your script and the output in the email is in tabular form which is exactly what I wanted so much appreciated, this is now scheduled at the start and end of the working day. I also have emails firing for logon event id 4624 and RDP Logon Type 10 so I know every time a user RDP&#039;s onto the Servers.
When I run your script directly from Powershell however as mentioned it still lists the objects opposed to being tabular and I am not sure why but it is not a problem because I only run this against 11 Servers I admin.

Regards]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-7703">Paul Contreras</a>.</p>
<p>Thanks for the response<br />
I have a few other scripts that I use to generate html email reports with the output embedded in the body of the email and nicely formatted using ConvertToHtml and -Fragment.<br />
I have used that along with your script and the output in the email is in tabular form which is exactly what I wanted so much appreciated, this is now scheduled at the start and end of the working day. I also have emails firing for logon event id 4624 and RDP Logon Type 10 so I know every time a user RDP&#8217;s onto the Servers.<br />
When I run your script directly from Powershell however as mentioned it still lists the objects opposed to being tabular and I am not sure why but it is not a problem because I only run this against 11 Servers I admin.</p>
<p>Regards</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Paul Contreras		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-7703</link>

		<dc:creator><![CDATA[Paul Contreras]]></dc:creator>
		<pubDate>Sun, 22 Jan 2023 18:48:10 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-7703</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-7702&quot;&gt;R W&lt;/a&gt;.

By default anything after 4 properties get added as a list (instead of a table).  if you want to get this email to you on a daily, you can use this article as reference.

&lt;a href=&quot;https://thesysadminchannel.com/automate-powershell-scripts-with-task-scheduler/&quot; rel=&quot;noopener&quot; target=&quot;_blank&quot;&gt;https://thesysadminchannel.com/automate-powershell-scripts-with-task-scheduler/&lt;/a&gt;

For the results, I would probably export it to a csv then send the csv as an attachment.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-7702">R W</a>.</p>
<p>By default anything after 4 properties get added as a list (instead of a table).  if you want to get this email to you on a daily, you can use this article as reference.</p>
<p><a href="https://thesysadminchannel.com/automate-powershell-scripts-with-task-scheduler/" rel="noopener" target="_blank">https://thesysadminchannel.com/automate-powershell-scripts-with-task-scheduler/</a></p>
<p>For the results, I would probably export it to a csv then send the csv as an attachment.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: R W		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-7702</link>

		<dc:creator><![CDATA[R W]]></dc:creator>
		<pubDate>Sun, 22 Jan 2023 18:40:34 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-7702</guid>

					<description><![CDATA[Hi Paul
Nice script, for me however, each object is getting listed 1 after the other, opposed to in tabular format, do you know why? (Windows 10, Powershell version 5.1)
Is it possible to get the output to be emailed on a daily schedule?
Thanks in advance]]></description>
			<content:encoded><![CDATA[<p>Hi Paul<br />
Nice script, for me however, each object is getting listed 1 after the other, opposed to in tabular format, do you know why? (Windows 10, Powershell version 5.1)<br />
Is it possible to get the output to be emailed on a daily schedule?<br />
Thanks in advance</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Muzik		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-7616</link>

		<dc:creator><![CDATA[Muzik]]></dc:creator>
		<pubDate>Thu, 19 Jan 2023 15:16:36 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-7616</guid>

					<description><![CDATA[Paul
Not one to post, but i just had to. Coz its awesome work AND pretty neat (very structured and clean) too!
Thank you!]]></description>
			<content:encoded><![CDATA[<p>Paul<br />
Not one to post, but i just had to. Coz its awesome work AND pretty neat (very structured and clean) too!<br />
Thank you!</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Keith		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-1161</link>

		<dc:creator><![CDATA[Keith]]></dc:creator>
		<pubDate>Wed, 08 Jun 2022 00:58:56 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-1161</guid>

					<description><![CDATA[In reply to &lt;a href=&quot;https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-1160&quot;&gt;Keith&lt;/a&gt;.

Oh - I didn&#039;t see the space between the dots (. .\) to dot source.  Never had to do that before - interesting.
You mentioned it&#039;d be usable to find a logged in user - I tried using * with something like &#039;Get-ADComputer&#039;, but I guess it isn&#039;t that simple.]]></description>
			<content:encoded><![CDATA[<p>In reply to <a href="https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-1160">Keith</a>.</p>
<p>Oh &#8211; I didn&#8217;t see the space between the dots (. .\) to dot source.  Never had to do that before &#8211; interesting.<br />
You mentioned it&#8217;d be usable to find a logged in user &#8211; I tried using * with something like &#8216;Get-ADComputer&#8217;, but I guess it isn&#8217;t that simple.</p>
]]></content:encoded>
		
			</item>
		<item>
		<title>
		By: Keith		</title>
		<link>https://thesysadminchannel.com/get-logged-in-users-using-powershell/#comment-1160</link>

		<dc:creator><![CDATA[Keith]]></dc:creator>
		<pubDate>Wed, 08 Jun 2022 00:35:25 +0000</pubDate>
		<guid isPermaLink="false">https://thesysadminchannel.com/?p=2159#comment-1160</guid>

					<description><![CDATA[This doesn&#039;t seem to work for me... I tried the steps in PowerShell 7 and Windows PowerShell 5.1 (Windows 11).]]></description>
			<content:encoded><![CDATA[<p>This doesn&#8217;t seem to work for me&#8230; I tried the steps in PowerShell 7 and Windows PowerShell 5.1 (Windows 11).</p>
]]></content:encoded>
		
			</item>
	</channel>
</rss>
