Automatically turn PCs on and off


I would like to use a script to automatically turn on any PC that has not been turned on for more than a month via Wake On Lan and turn it off after 5 hours.

How can I remember the PCs that were turned on?

Thanks in advance

0 Comments   [ + ] Show comments

Answers (2)

Posted by: Nico_K 1 year ago
Red Belt

you have a few options.
1. build a smart label which contains all systems where the last boot is >1month.
2. use the powershell function Get-Uptime (you can use -Since to get the date or a findstr days to get the number of days since the last boot.)
3. use wmi for getting the info ( wmic OS get LastBootupTime) when the systrem was booted last time (YYYYMMDDHHMMSS.???????)

Please be aware that using "Start|Shutdown" nowadays does not shut down the system but hibernates it. You can force it or force a reboot to really reboot or disable the hibernation mode.

  • You can't use a smart label to identify machines that haven't booted because they are applied when the machine updates inventory. - chucksteel 1 year ago
Posted by: chucksteel 1 year ago
Red Belt

There really isn't a great way to automate something like this, unfortunately. There are many reasons why a computer hasn't been powered on or has not checked into the appliance for an extended period of time. Chances are the machine doesn't have a network connection, so sending a wake on LAN packet isn't going to help.

We set the BIOS for desktop computers to wake according to patch schedule, so most of our machines power on at least once a week. Our default power savings settings are to enter hibernation after 180 minutes. 

Technicians receive an email on the first of the month letting them know which computers they support haven't checked in with the SMA in the past month and it is part of their responsibilities to figure out why. 

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login


This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ