Posted before, but..
A few years ago, my boss wanted to open up some of our computers for people to use the internet. A sort of internet cafe, without the cafe part. As he didn't want people hogging the machines, he wanted some way to kick them off after a predetermined time..
Being a keen c++ programmer at the time (still am really, just don't get time for it), and having recently found out how to write Windows Screen Savers )for another project, can't recall much about it though).
So, I knocked up a screensaver that when instantiated, would do a forced shutdown and reboot.
I should point out at this time that when you run the initiatesystemshutdown API on Windows with the Forced and reboot options set, windows will reboot the machine, and will not get you the option to save your work.
I had the main screensaver working, and was working on the code to register it as the system screensaver, and, IIRC, a control panel applet to set some options.
I had just run the install code to test if was setting the system screensaver correctly, and got called away to sort something out. I hadn't actually saved anything, and, as a result, when the screensaver kicked in, I lost everything.
I didn't recreate it. I had always had reservations about doing it, particularly would we, as a department, be liable if an employee from another department did work on it (we had signs everywhere saying the machines were for general internet browsing only), and lost work as a result. My boss quietly abandoned the idea when I pointed that out to him.
We do have a product installed now on some computers that does the same thing (just using it's own timing mechanism rather than installing itself as a screensaver). It wasn't my decision to install it, but at least the new one makes clear to the user what will happen, and when. As such, if a user users the computer, leaves it and loses work as a result, it's their responsibility, not ours.