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
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.
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.