Windows 10 is pretty bae. We have this Stockholm Syndrome thing going on, where I can’t imagine how boring life must be developing on a non-experimental/in-development OS. What would I do all day? How would I bond with my coworkers if we didn’t have the shared suffering of dogfooding/flighting/self-hosting? Unthinkable.
Mostly updates happen at about 3am, but sometimes Windows decides to have my back in a non-obvious way. Like at 7pm it’ll be all “Whoops sorry you have to go home now. Enjoy the sunshine”. Or I’ll come back from lunch and have a forced break where I get to read textbooks or find out what the rest of my team are working on. Windows and I are total bros, I’d just appreciate some more communication.
So today after my computer finished updating I finally set some notifications up.
$smtp = New-Object Net.Mail.SmtpClient($smtpServer) $smtp.Send($smtpFrom, $smtpTo, $messageSubject, $messageBody)
Task Scheduler vs Local Policies
Task Scheduler seemed like a sensible place to start; you pick a trigger (time or event) and combine it with an action. Actions used to including send emails (!) but now only allow you to set arguments and execute a program. Running powershell and passing it the script path was easy enough and worked perfectly…for start up.
Unfortunately Task Scheduler doesn’t have an on-shutdown trigger, so that threw a spanner in the works.
This helpful Stack Overflow answer pointed me to gpedit.msc, to edit Local Policies. It has both shutdown and startup triggers, but a more limited set of actions - you can only run scripts. As it turned out, this was exactly the functionality I wanted - the scripts can be either cmd or powershell scripts, so I didn’t even have to write a wrapper .cmd file.
Email -> Text
Most phone providers have a system for converting emails sent to $phone-number@domainname into an SMS to $phone-number. It took me about 30 seconds to find T-Mobile’s (tmomail.net), and then adding the the text message cherry-on-top took 2 seconds.