Script via Task Scheduler no longer works

Welcome Forums General PowerShell Q&A Script via Task Scheduler no longer works

This topic contains 3 replies, has 3 voices, and was last updated by

NR
 
Participant
3 months ago.

  • Author
    Posts
  • #111277

    Participant
    Points: 0
    Rank: Member

    Good day all.  We have a script that is set to run from Task Scheduler that had been working for over a year and now has stopped functioning on most, but not all, servers.  This was first noticed several months back but not looked into so troubleshooting a related Windows update would be hard but that is the current thinking as to what broke this.  The script still functions properly if logged onto the server and ran directly in PowerShell but it does not function if selecting the Run option in the Task Scheduler Library.  Below is the details of how this is setup where it's been working and suddenly stopped.  This was working on Server 2008R2 and 2012 in the past with a mix of PowerShell versions 2 – 5 then suddenly stopped. Any tips would be appreciated.
     
    Task Settings:
    Task is set to run as a domain admin account and "Run with highest privileges" is selected
    Triggered weekly at 1am
    Action: Start a program
    Program/script: powershell
    Add arguments: .\script1.ps1
    Start in: \\domain\netlogon\scripts
    All other Task settings are default
     
    If this task it run manually it returns (0x1)
    "Task Scheduler successfully completed task "\PS-Task1" , instance "{0efc8244-fc16-4c90-aadc-ccd5e655957c}" , action "C:\Windows\System32\WindowsPowerShell\v1.0\powershell.EXE" with return code 1."
    "Task Scheduler successfully finished "{0efc8244-fc16-4c90-aadc-ccd5e655957c}" instance of the "\PS-Task1" task for user "Domain\svc_PS-Task1"."
     

  • #111329

    Participant
    Points: 884
    Helping Hand
    Rank: Major Contributor

    You said,

    now has stopped functioning on most, but not all, servers

    If it is an update(probably installed in all servers), will cause the same issue for every server.
    So you can check what is changed in common for the servers where the script is not working.

    • #111730

      Participant
      Points: 0
      Rank: Member

      Yeah we attempted this and we were not able to figure out the common change.  Everything that was thought of was tested and proven not to be the cause or correction to the issue.

  • #111736
    NR

    Participant
    Points: 0
    Rank: Member

    Hello Nick

    Do you mean to say it runs ok when triggered manually ?

    is the option run weather user is logged on or not greyed out ?

The topic ‘Script via Task Scheduler no longer works’ is closed to new replies.