<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Shutdown on ETDWH.com</title><link>https://www.etdwh.com/tags/shutdown/</link><description>Recent content in Shutdown on ETDWH.com</description><generator>Hugo</generator><language>en-us</language><lastBuildDate>Fri, 15 Apr 2016 00:00:00 +0000</lastBuildDate><atom:link href="https://www.etdwh.com/tags/shutdown/index.xml" rel="self" type="application/rss+xml"/><item><title>Automatic Shutdown If No One Logs In</title><link>https://www.etdwh.com/posts/automatic-shutdown-if-no-one-logs-in/</link><pubDate>Fri, 15 Apr 2016 00:00:00 +0000</pubDate><guid>https://www.etdwh.com/posts/automatic-shutdown-if-no-one-logs-in/</guid><description>&lt;p&gt;Ok, here is my situation.&lt;/p&gt;
&lt;p&gt;Once I&amp;rsquo;m done using my home PC for the day, I shutdown my Windows 10 PC as I normally would from the Start menu. The next morning, while I&amp;rsquo;m away at work, my son comes along, presses a few keys on my keyboard, and my PC switches on back to life. My PC remains on for the whole day until I come back home from work.&lt;/p&gt;
&lt;p&gt;Sounds familiar? Well, that is what I faced, and I was looking for an automated solution: once my PC turns on, wait for several minutes, then check if someone is logged in. If no one is logged in, shutdown the PC. And here is what I finally ended up with.&lt;/p&gt;
&lt;p&gt;I wanted something which will work and log what happens as well. And being that PowerShell is sort of the &amp;ldquo;replacement&amp;rdquo; of VBS and CMD files, this would be in PowerShell as well.&lt;/p&gt;
&lt;p&gt;First things first, how do i detect if someone is logged in to the machine? Turns out, this can be quite complicated. The first Google link I found was on the &lt;a href="https://community.spiceworks.com/topic/414076-powershell-getting-current-logged-on-user"&gt;Spiceworks Forum&lt;/a&gt;. That did not work. Then I tried a few more links. All seemed far too complicated, although it would eventually work. I think.&lt;/p&gt;</description></item></channel></rss>