Putting a Windows 10/11 computer to sleep over the network using SSH.


Recommended Posts

So I have a little Lenovo computer I got off eBay for the sole purpose of displaying my security cameras above my TV. It's a Pentium with 4GB of ram and uses around 11 watts. But I don't need it awake and running at night when I'm sleeping or out of the house.

I was looking for a way to put it to sleep remotely because there is no mouse and keyboard hooked up to it. I found a way to do it via SSH. Install OpenSSH on the computer, install putty on my computer, and create a batch file which when ran, connects to the SSH server using putty and sends the following sleep command.

 RUNDLL32.EXE powrprof.dll,SetSuspendState

The Bat file looks like this

putty.exe -ssh owner@IP address -pw Password -m c:\command.txt

You replace the ip address with the ip address of the computer and the password with the password of the computer. Then just put the rundll command above in the command.txt.

Then to wake it up I simply use a wake-on Lan app. I was surprised how well it worked on my first attempt, which can be seen in the video below.

11 watts isn't much, but a little here and a little there and it adds up.

  • +Warwagon changed the title to Putting a Windows 10/11 computer to sleep over the network using SSH.
  On 09/02/2023 at 16:08, Warwagon said:

11 watts isn't much, but a little here and a little there and it adds up.

Expand  

Yeah to the tune of what about 65 cents a month, if you leave it off for 16 hours a day and elec costs you like 12 (national average or so) cents a kwh.. So what 8$ in a year - you could buy yourself a starbucks coffee ;) heheh

But its not fully off is it, so are you really saving the whole 11 watts or is it something less than that your saving? ;) I am all for saving electric and all - but is the say 2 cents a day worth it if something fails and it doesn't come back up when you want to see whats on the camera? ;)

  On 09/02/2023 at 20:05, BudMan said:

Yeah to the tune of what about 65 cents a month, if you leave it off for 16 hours a day and elec costs you like 12 (national average or so) cents a kwh.. So what 8$ in a year - you could buy yourself a starbucks coffee ;) heheh

But its not fully off is it, so are you really saving the whole 11 watts or is it something less than that your saving? ;) I am all for saving electric and all -

Expand  

I'm just a tightwad who also hates wasting electricity.  Also my elec cost is 8 cents for the first 1,000 kw then it goes down to 4 cents. At least during the winter.

So, get this, I just put all 4 of my couch computer monitors on a surge protector connected to a voice-controlled outlet. So at night, I say "Ok, Google, turn off the monitors" and the combined sleep of all 4 monitors which was 3 watts, is now 0 :) (I put a kill-a-watt on it)

But I can also tell them to turn off when i'm down stairs in my office, not even on the couch computer. In that case it saves 180 watts

So now we are up to about 13 watts! woot! (little computer is probably burning 1 watt just to sleep.

As per the last bit, the computer gets turned on when I wake up in the morning and get turned off when I go to bed.

  • Like 1
  • Love 1
  On 09/02/2023 at 20:26, BudMan said:

4 cents per kwh?  JFC that is cheap.. So your saving what like $2.5 a year.. Not even enough for a coffee ;)

Expand  

 

  On 09/02/2023 at 20:26, BudMan said:

4 cents per kwh?  JFC that is cheap.. So your saving what like $2.5 a year.. Not even enough for a coffee ;)

Expand  

Its enough for a Tim Hortons coffee... lol

  • Haha 1
  On 09/02/2023 at 23:18, Matthew S. said:

Its enough for a Tim Hortons coffee... lol

Expand  

I think that's almost enough for Dunkin' if I remember right..

I would be more interested in this 4 cents you say your paying, or even 8 cents .  So if you go over 1000 kwh for the month the rate drops to 4 cents?  That is some cheap power to be sure, prob not much solar in your area at those rates.

Do they hit you with high delivery charges?  This is what can be confusing in finding true cost of power in some areas - where sites will list the cost per kwh, they don't always show the delivery charges..

Here in chicagoland the price per kwh is only like 9 some cents.. But then they add on another like 4 cents for delivery of that electric per kwh.  And then there is just the charge for being a customer, and the meter charge..

Hope my jokey way of responding didn't come across that not worth saving some kwh here or there.. But there is prob some bigger fish to fry in saving electric than something that only uses like 10 watts..  And shutting it down for a few hours a day.

How long do you leave it off vs on is needed to know how much actual kwh you might be saving as well.

 

 

 

 

 

  On 11/02/2023 at 05:36, BudMan said:

I would be more interested in this 4 cents you say your paying, or even 8 cents .  So if you go over 1000 kwh for the month the rate drops to 4 cents?  That is some cheap power to be sure, prob not much solar in your area at those rates.

Do they hit you with high delivery charges?  This is what can be confusing in finding true cost of power in some areas - where sites will list the cost per kwh, they don't always show the delivery charges..

Here in chicagoland the price per kwh is only like 9 some cents.. But then they add on another like 4 cents for delivery of that electric per kwh.  And then there is just the charge for being a customer, and the meter charge..

How long do you leave it off vs on is needed to know how much actual kwh you might be saving as well.

Expand  

image.png.10f1aee4aa2553f68a37b2a526686f68.png

I forgot, that there is also the Energy Adjustment Clause, where they adjust what the have to pay. I have no gas and just have heat pump. Usually during months were the heat or ac doesn't have to run my electric bill is about $60.

  Quote

Hope my jokey way of responding didn't come across that not worth saving some kwh here or there.. But there is prob some bigger fish to fry in saving electric than something that only uses like 10 watts..  And shutting it down for a few hours a day.

Expand  

For sure, I've done best I could, even replacing computers with lower power ones that do the same thing.

But then I go and build a new computer more power hungry than the last one. But if ya want performance gotta use some power.

  On 10/02/2023 at 17:32, Warwagon said:

Do tell.

Expand  

It's funny, I just finished watching this video and then I saw this thread. There are some neat tips throughout the video, but he talks specifically about shutting down remote computers at 14:43:

 

you used 2782 Kwh in 1 month?  WTF dude..  That is insane.. I have never used that much even in the summer with the AC running like constantly since the wife likes it 67 degrees..

Here is old bill showing before went solar

beforesolar.jpg.dab08157af3ba7b1c4107e6c832b677e.jpg

You used like what I used in 2 months in summer with AC going full bore..

 

 

  On 11/02/2023 at 22:58, BudMan said:

you used 2782 Kwh in 1 month?  WTF dude..  That is insane.. I have never used that much even in the summer with the AC running like constantly since the wife likes it 67 degrees..

Here is old bill showing before went solar

beforesolar.jpg.dab08157af3ba7b1c4107e6c832b677e.jpg

You used like what I used in 2 months in summer with AC going full bore..

 

 

Expand  

Air conditioning is much cheaper than heat pump in the winter. We had a Lowe’s in the -20. . At that point the emergency heat kicks on and I’m using electric heat. Actually under 15° needs assistant from the emergency heat.

  On 11/02/2023 at 23:01, Warwagon said:

and I’m using electric heat.

Expand  

Ugghhh.. Yeah that would suck.. Good thing your rate over 1k is only 4 cents ;)

  On 09/02/2023 at 16:08, Warwagon said:
RUNDLL32.EXE powrprof.dll,SetSuspendState 0,1,0
Expand  

Please stop spreading incorrect information. Your 0,1,0 parameters here do nothing! It is undefined if this command will sleep or hibernate. You are lucky it does not just crash and burn.

 

  Quote
Expand  

See also:

Shutdown.exe on recent versions can hibernate but not sleep for unknown reasons. Use Powershell instead for sleep.

Edited by WndSks
  On 12/02/2023 at 22:04, WndSks said:

Please stop spreading bad information. Your 0,1,0 parameters here do nothing! It is undefined if this command will sleep or hibernate. You are lucky it does not just crash and burn.

 

See also:

Expand  

I can confirm the 0,1,0 are not needed. I found that command online from numinous sources, so I didn't think to modify it, but I did remove those numbers from the command and it still works. Removed the numbers from the command on the first post.

  On 12/02/2023 at 22:19, Warwagon said:

and it still works

Expand  

but it is still incorrect and the result is undefined. There is simply no way to correctly call this function with rundll32. You must p/invoke with powershell.

 

Something along the lines of

Add-Type -Assembly System.Windows.Forms
[System.Windows.Forms.Application]::SetSuspendState([System.Windows.Forms.PowerState]::Suspend, $true, $false)

(I did not test this but it should be close)

  On 13/02/2023 at 01:00, farmeunit said:

Why don't you just schedule it?

Expand  

Because I don't always go to bed at the same time. I also want to put it to sleep if I leave the house for the day.

It doesn't have to be an exact schedule.  Just set to midnight if you go between 10-midnight.  As for leaving the house, use IFTT.  Set up something on your phone like a geofence.  You could probably even tie it into Alexa, so when you say Goodnight, it turns it off.  And when you say something else it turns it on.  Of course that requires WoL or something like that.  Lots of ways to really do it, but you need to right combination or hardware.

Honestly, use a smart plug.  Problem solved.

  On 18/02/2023 at 23:52, farmeunit said:

It doesn't have to be an exact schedule.  Just set to midnight if you go between 10-midnight.  As for leaving the house, use IFTT.  Set up something on your phone like a geofence.  You could probably even tie it into Alexa, so when you say Goodnight, it turns it off.  And when you say something else it turns it on.  Of course that requires WoL or something like that.  Lots of ways to really do it, but you need to right combination or hardware.

Honestly, use a smart plug.  Problem solved.

Expand  

Smart plug is like yanking the power out of the wall while it's running. Honestly I'm really happy with this setup. It works perfect for what I need.

If you're just using it for viewing cameras and such, it doesn't really matter.  Especially with mostly solid state parts.  The only time it really matters if it's writing data because it could get corrupted.  Otherwise, it makes little to no difference.  That being said, you can automated the whole process before actually shutting off the plug.  Then you can have it return to the last power state once the plug is turned on.  I was just giving you options instead of focusing on one way to do it.

 

Home Assistant or several other options available.

  On 20/02/2023 at 20:45, farmeunit said:

If you're just using it for viewing cameras and such, it doesn't really matter.  Especially with mostly solid state parts.  The only time it really matters if it's writing data because it could get corrupted.  Otherwise, it makes little to no difference.  That being said, you can automated the whole process before actually shutting off the plug.  Then you can have it return to the last power state once the plug is turned on.  I was just giving you options instead of focusing on one way to do it.

Expand  

Ya, I could have the computer shut down at X time, and then set it so a smart outlet turn off. Or I can just double click a batch file 3 seconds before I get off the couch and go to bed.

I do shut the machine off when I leave for 3 or 4 days.

Thanks for the options though.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • This site is just old men ranting at clouds. Neowin knows its audience.
    • That's nice and all. but I generally just stick with Lutris paired with 'ge-proton' (which gets updated fairly often (June 1st was last update) as the 'ge-proton' entry in Lutris uses stuff here... https://github.com/GloriousEggroll/proton-ge-custom/releases ) and the like to play my games. p.s. if a person wants to stick with a specific version from that link you can download a specific version and extract it to "~/.local/share/lutris/runners/proton/". then select it in Lutris options on game shortcut is the basic idea. because by default the standard 'ge-proton' entry will automatically get updated which can occasionally cause issues even though it's usually fine. but manually setting it on a specific version will prevent the standard updates on 'ge-proton' from messing with it on a particular game you may have issues with if that gets updated etc. one good example of the 'ge-proton' updates messing with a game in particular is the offline version of RDR2 1491.50 as I setup a specific version there and after removing the 'vulkan-1 (native)' entry in 'Wine configuration' on 'RDR2.exe' entry (if you don't remove this the game won't start up) is when the 'ge-proton' updates, it will restore that 'vulkan-1 (native)' entry and prevent the game from working. you can always remove the entry on the RDR2.exe in Wine configuration specifically after updates, but doing that everytime that updates will get old quickly. hence, keeping it on a specific GE Proton version stops me from having to mess with it as then you just adjust it once and you are done with it. also, when using 'bat' files to start a game (like Hitman: WoA for example using Peacock etc) I had some issues with GE Proton after '9-27', so I got the game locked to '9-27' (April 1st) instead of the newer ones (10-1 etc).
    • Sam Altman says AI could soon help with discovering new knowledge by Hamid Ganji OpenAI is currently at the forefront of developing powerful AI models, while its ChatGPT product is rewriting our traditional way of looking for new information. The company's CEO, Sam Altman, now says AI could even help humans discover new knowledge. He also described AI agents as junior employees. Speaking at the Snowflake Summit 2025, Altman boasted that AI agents can act like junior employees, saying, "You hear people that talk about their job now is to assign work to a bunch of agents, look at the quality, figure out how it fits together, give feedback, and it sounds a lot like how they work with a team of still relatively junior employees." OpenAI CEO also added AI agents could help humans discover new knowledge in "limited cases" or "figure out solutions to business problems that are kind of very non-trivial." While the use of AI for scientific discovery is still viewed with skepticism, the technology has proven its capabilities for new discoveries in several cases. For example, the Microsoft Discovery platform, designed for accelerating scientific research and development by AI agents, was recently able to discover a new chemical for cooling data centers in just 200 hours, a process that normally takes years to research and complete by humans. AI firms are also shifting their focus toward developing AI agents capable of performing various tasks. OpenAI recently unveiled Codex, which contains AI agents for helping programmers write and debug code. According to Altman, OpenAI engineers are already using Codex. As AI agents become more intelligent, more employees should be concerned about losing their jobs. Companies have already started replacing some specific roles with AI. For example, Duolingo has replaced its contract workers with AI, while Shopify managers need to provide reasons why AI cannot handle a job before seeking approval for new hires. Via: Business Insider
    • I personally don't think there will be many survivors past the ESU date, but I can be wrong🙂 >Firefox still supports Windows 7 (until the end of August), which will be just over 16 years since release. Well, yes, but it's an ESR version, which kind of doesn't count as fresh for me. So the last mainline version of Firefox with W7 support was 115, which was released in 2023, exactly around the W7 ESU expiration.
    • Hey, sounds like it’s definitely time for an upgrade. The R7000 had an excellent run! If you want lots of wired ports and future-proofing, the Asus RT-BE88U is a killer choice. It’s got 2x 10GbE, 4x 2.5GbE, and handles WiFi 7 like a champ. Super fast, stable, and the ASUS firmware is solid with loads of features. The TP-Link BE900 is also great, sleek design, strong performance, and a combo 10G port (RJ45/SFP+), but it has fewer wired ports than the Asus. Netgear RS700S is powerful too, but the firmware isn’t as flexible and only has one 10G port. It might feel familiar from your R7000. If wired ports are a big deal, maybe adding a 2.5G or 10G switch later gives you more options. My vote is RT-BE88U all the way.
  • Recent Achievements

    • First Post
      nothin earned a badge
      First Post
    • Enthusiast
      Epaminombas went up a rank
      Enthusiast
    • Posting Machine
      Fiza Ali earned a badge
      Posting Machine
    • One Year In
      WaynesWorld earned a badge
      One Year In
    • First Post
      chriskinney317 earned a badge
      First Post
  • Popular Contributors

    1. 1
      +primortal
      186
    2. 2
      snowy owl
      130
    3. 3
      ATLien_0
      130
    4. 4
      Xenon
      120
    5. 5
      +FloatingFatMan
      96
  • Tell a friend

    Love Neowin? Tell a friend!