So I’ve blogged about about tools (Cron to run scheduled tasks. But what exactly should you schedule?
Today let’s talk about turning your PC on and off. Do you do that manually?
I like to save trees so I power my computer off each evening. But not when I leave the office. I leave my PC running in case I need to remote into it from home. But after 10pm or so it’s unlikely I’ll be dialing in - so the computer can be turned off - but I’m not driving back to work to hit the power button! :)
First grab a copy of PSTools from SysInternals. SysInternals has a load a great tools and PSTools itself contains several useful utilities but we’re interested in
PsShutdown - shuts down and optionally reboots a computer
Download PSTools, copy the files somewhere in your system path (C:\Program Files\ etc) so that you can open a command prompt and enter _psshutdown _and it will run.
Next lets create a simple batch file to call this:
# Uses psshutdown from SysInternals (now Microsoft) PsShutdown.exe -o -f -k
Save this file as shutdown.cmd
There is a huge list of options available for PsShutdown but we just need a few:
- -o Logoff the console user.
- -f Forces all running applications to exit during the shutdown instead of giving them a chance to gracefully save their data.
- -k Poweroff the computer (reboot if poweroff is not supported).
When I leave the office I usually close everything but the -f will force any open applications to quit, and -k will actually power off the machine.
So I simply setup a scheduled task to run this batch file every day at 10:00PM and save some energy in the middle of the night.
In The Morning
Do you roll into work - power on your PC and then spend 10 minutes gabbing to co-workers and grabbing coffee? When I roll into the office my computer is on and ready for me to get to work! Every computer may not have this option but most Dell’s I’ve used have an option within the BIOS to power-on the computer at a specific time. So I have my PC set to crank up at 7:00AM so when I crawl into the office at 8:00 my PC is ready to go.
If your computer BIOS doesn’t have a power-on option and you are using Windows 7 you could possibly put your computer to ‘sleep’ and then use the new Task Scheduler to ‘wake up’ the computer using “Wake the computer to run this task” condition.
In the next entry we’ll talk about automating all the services you have running on your machine.