Schedule disappeared

Just in case, I opened an issue on github: Schedule disappeared - Getting error in notificaiton bar · Issue #538 · ironmansoftware/issues · GitHub
A schedule I had running has disappeared. I thought maybe someone deleted it, but I looked in the notification bar and I am getting:

Invalid configuration: schedules.ps1

Sequence contains no elements

10/04/2021 10:00 AM

I checked schedules.ps1 and it is there, and no one has modified that file.

New-PSUSchedule -Cron "1 2,4 * * *" -Script "ContainerGetINCount.ps1" -TimeZone "America/New_York" -Credential "Default" -skipRedefine 'N' 
New-PSUSchedule -Cron "30 8 * * *" -Script "ContainerGetINCount.ps1" -TimeZone "America/New_York" -Credential "Default" -skipRedefine 'N'
Product: PowerShell Universal
Version: 2.3.2

This can happen if you have a script in scripts.ps1 that doesn’t actually exist on disk. In 2.3.1, if a script is missing, it will cause all scripts to fail to load. We fixed that in 2.4. It can also happen if ContainerGetINCount.ps1 doesn’t exist for some reason.

I was able to run the script manually from within side of PSU?
So another script could be causing the rest of the file to not read? This one is at the end of my schedule.ps1? I just noticed this one because it was a new critical one I scheduled but now that you mention it my schedule page looks awfully light.

Right. So for example, if you have a scripts.ps1 like:

New-PSUScript -Name Script.ps1 -Path Script.ps1
New-PSUScript -Name Script2.ps1 -Path Script2.ps1

If Script.ps1 does not exist within C:\ProgramData\UniversalAutomation\Repository, it will fail to read the scripts.ps1 file.

This causes a chain effect where when it attempts to create the schedules, it won’t find scripts that were scheduled. So for example, in my schedules.ps1, if I had script2.ps1 scheduled, the schedule would also not show up. Also, ensure that a scheduled scripts within schedules.ps1 exist within scripts.ps1.

This would fail since the scripts don’t exist within PSU.

New-PSUSchedule -Script Script2.ps1 -Cron '* * * * *' 

The way to resolve this is to ensure that the scripts that are listed in scripts.ps1 actually exist on disk within C:\ProgramData\UniversalAutomation\Repository.

And like I said, we have a fix for this so you won’t have this problem in the next version. It will simply just be a notification that a particular script file is missing.

1 Like

@adam Make sense. It looks like it did not load this entry:

New-PSUSchedule -Cron "01 0 * * *" -Script "Test.ps1" -TimeZone "America/New_York" -Credential "Default" -Name "End of Day" 

New-PSUSchedule -Cron "0 5 * * *" -Script "Test.ps1" -TimeZone "America/New_York" -Credential "Default" -Name "End of Day part 2" 

However, it exists in the Repository directory:

    Directory: C:\ProgramData\UniversalAutomation\Repository

Mode                LastWriteTime         Length Name                              
----                -------------         ------ ----                              
-a----        9/15/2021  10:00 AM            916 Test.ps1                          

I checked the schedule.ps1 against the directory and everything matches?

And that script is also listed in scripts.ps1?


New-PSUScript -Name "Test.ps1" -Description "Test" -Path "Test.ps1" -Environment "5.1.17763.1490" -InformationAction "Continue"