Closed lowlydba closed 7 months ago
I have searched and found no existing issue
End date cannot be before start date 30200525
When a null end date is supplied, it incorrectly tries to check it as being less than the start date. It is missing the first check to see if it is not null before proceeding, like the check above it:
https://github.com/dataplat/dbatools/blob/71920cb9245349581e70a54eed447959a8d34ba1/public/Set-DbaAgentSchedule.ps1#L343-L350
Set-DbaAgentSchedule -SqlInstance sql1 -Job Job1 -ScheduleName daily -StartDate 20250101 -EndDate $null
Major Minor Build Revision ----- ----- ----- -------- 2 1 8 -1
No response
PowerShell Core (pwsh.exe)
Various
Verified issue does not already exist?
I have searched and found no existing issue
What error did you receive?
When a null end date is supplied, it incorrectly tries to check it as being less than the start date. It is missing the first check to see if it is not null before proceeding, like the check above it:
https://github.com/dataplat/dbatools/blob/71920cb9245349581e70a54eed447959a8d34ba1/public/Set-DbaAgentSchedule.ps1#L343-L350
Steps to Reproduce
Please confirm that you are running the most recent version of dbatools
Other details or mentions
No response
What PowerShell host was used when producing this error
PowerShell Core (pwsh.exe)
PowerShell Host Version
Various
SQL Server Edition and Build number
Various
.NET Framework Version
Various