I'm trying to run the script from https://gallery.technet.microsoft.com/Password-Expiry-Email-177c3e27 I've corrected the variables for my environment and I'm able to run it from my workstation and the server just fine when running it manually but when I try to schedule it with Task Scheduler the task seems to run fine but nothing is sent out.
I've check my event logs and do not see errors popping up and the task history says the instance comes back with return code 0.
I've checked these - two questions and other from Googling but adding extra arguments other than -file C:\path\script.ps1 seems to give long numbered return codes or just keeps running.
I'm running the task as administrator, running whether the user is logged on or not, running with highest privileges, and trying to have it run every night at midnight.
Is there anything else I'm missing?