I'm hoping you geniuses can help me out today. I'm not a savant with PowerShell, I only use it to automate some tasks to make life easier. The one thing I'm trying to automate is a daily password reminder to those employees whose password will be expiring within 14 days. The script I wrote (NewPasswordChange.ps1) works flawlessly when I run it via PowerShell, but will not run when put into Task Scheduler. Please let me know what I'm doing wrong.
Action: Start a program Program/Script: C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe
Add Arguments: -File 'NewPasswordChange.ps1' -smtpServer 'COMPANY-com.mail.protection.outlook.com' -expireInDays '14' -from 'IT Support it_support@COMPANY.com' -Logging -LogPath 'c:\logFiles'