locked
Password Expiry Email Notification RRS feed

  • Question

  • I downloaded the script from here

    https://gallery.technet.microsoft.com/scriptcenter/Password-Expiry-Email-177c3e27

    It fails as a scheduled task, but runs perfect when ran manually

    Running on a DC server 2016

    I am a domain administrator

    I do have run as batch job permissions

    For the program script I have this in Task Scheduler I have

    C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe

    Under arguments I have

    C:\Scripts\PSC.ps1 -smtpServer 10.*.**.** -expireInDays 11 -from "IT Support <helpdesk@********.org>" -Logging -LogPath "c:\logFiles" -reportTo buchananm@********.org -interval 1,10

    Start in is blank

    Last Run result 0x1

    • Moved by Bill_Stewart Monday, March 12, 2018 9:42 PM This is not a support forum for gallery scripts
    Friday, January 19, 2018 1:39 PM

All replies

  • The script was not designed to run as a task.

    We do not fix scripts you have copied from the Internet.  Post to the authors Q&A page.

    https://gallery.technet.microsoft.com/scriptcenter/Password-Expiry-Email-177c3e27/view/Discussions#content


    \_(ツ)_/

    Friday, January 19, 2018 1:44 PM
  • Hello,

    You can run this script using a scheduled task. At least it works in my environment.

    But you're calling the script wrong.

    Try to change the argument like that:

    -Command "& 'C:\Scripts\PSC.ps1' -smtpServer 10.*.**.** -expireInDays 11 -from 'IT Support <helpdesk@********.org>' -Logging -LogPath 'c:\logFiles' -reportTo buchananm@********.org -interval 1,10"

    Wednesday, January 24, 2018 1:21 PM