Expiring password reminder email via PowerShell

Enabling tougher password requirements usually results in massive IT headache. Users (especially mobile and remote users) don’t really get much warning as to when their password is going to expire. It’s no fun when users with no direct access to the domain controller let their password expire. The simplest solution is to spam them with more warnings.

While I think this should be built-in Windows functionality, it’s not. There’s even a paid product to fill this hole. Thankfully, lots of people have implemented this via Perl, VB Script and PowerShell. I wanted something as simple as possible, written in PowerShell, so I combined a few sources to make the following. Thanks to Rpieniazek and mjolinor, Steve Blossom and Microsoft