OK, I did this a while back to have more control over my computer when I am not at home. Keep in mind this method will turn off a computer with an “constant” internet connection i.e.(cable,DSL).
Basically you setup a rule in outlook to look for say a keyword in the subject line of an email. Then you select run application as the action for when that keyword is found. Then all you have to do is write a simple dos batch file and use the shutdown command with the -fs parameter to ensure the shutdown is not aborted by any running applications. After that the rest is simple you simply send a sms text message from your cell phone or other source to your email address. You must have automatic send and receive tunned on for this to work.
Ok so let’s get started.
Create a file called shutdown.bat in notepad with the following code in it.
shutdown -s
Save it to your C:\ drive so the path to the shutdown batch file is something like C:\scripts\shutdown.bat (Important this is a must the path must be exact) or you can modify the rule once you import it to point to the new destination it’s your call.
Now open outlook and adjust your settings to send and receive email every minute on the minute (1 minute for testing time can be increased if a delayed shutdown is desired.) now in Outlook in the file menu click Tools and select Rules and Alerts with the Rules and Alerts dialog open click the options button on the far upper right portion of the dialog window. Choose import rules from the options dialog and browse to the file C:\sms_functions\rules\shutdown.rwz
(the file was included in the downloaded project files) and your done. Now send a text message from your cell phone to your email address and in the subject use the key phrase smsshutdown%% (or make your own! :) and send it. When the email is received and found with the smsshutdown%% in the subject Outlook runs the dos batch file containing the shutdown -f command and shuts down your computer. You could also accomplish other task’s using this method using more dos commands, php scripts, perl what ever. This will work on Linux using pine also.
I hope this will be as useful to someone else as it has been to me.
Bonus Tip
I have found that this article explaining the MS-DOS SHUTDOWN Command Syntax can answer most of your questions about the command.
Update: I recently updated the file so it works the way it should thanks to everyone who helped in the comments. If you re download the files it should work for those of you whom it did not.
More Windows Automation Tips, Tricks and Software Also see my automation category for more Windows automation tips, tricks and software.
Instructions for creating your own RWZ files
- First open a notepad or other text editing program and type the following inside the file.
shutdown -fsc "SMS Remote Shutdown in progress..."
Save the file somewhere on your computer where it is easy to find. Something like say C:\sms_scripts\reboot.bat Also make sure your filename ends with the .bat extension so Windows knows it is an executable file.
- You will need to configure outlook with a rule to run when a speific keyword (mentioned above) is present in the subject line. To access the rules menu goto Tools > Rules and Alerts and create a new rule. Follow the setup wizard and create your rule and as an action select run program and navigate to your previously created batch file reboot.bat or whatever name you chose.
Once you have followed the above two steps send an sms text message to your computers email address “with Outlook running” and test it out. You should the text in the -c “text here” part of the batch file. This just explains to the user that the system is shutting down from and sms request. Have fun and enjoy this little trick.