lordmilko / PrtgSensors

Miscellaneous sensors for PRTG Network Monitor
MIT License
9 stars 3 forks source link

An exception occurred while trying to process backups: Die Zeichenfolge wurde nicht als gültiges DateTime erkannt. #4

Open Lupusonwork opened 2 years ago

Lupusonwork commented 2 years ago

We also use schedules that run after other backups (parent jobs). These lead to this error. As a work a round I have included the following in the script to intercept the call: if ($this.job.ParentScheduleId -eq $null -or $this.job.ParentScheduleId -eq ""){ ...[TimeFormatter]::GetNextBackupStartTimeText($epSchedule.NextRun) }

It would be nicer if the schedule could be read from the parent job.

lordmilko commented 2 years ago

What is the value of the schedule (stored in NextRun) that is causing the exception?

Also are you able to advise what version of Veeam you are using? Typically this error occurs for me when Veeam is using a different value to signify no value. In the past Veeam has used the value 1/01/0001 12:00:00 AM to signify no schedule is set, but some versions change this to something else

Lupusonwork commented 2 years ago

NextRun has no value. image

Version: 11.0.1.1261 P20220302

lordmilko commented 2 years ago

Are you able to advise whether the value is null or an empty string?

One of

$someObject.NextRun -eq $null

or

$someObject.NextRun -eq ""

should return True, where $someObject is the object you stored the Veeam backuo job info in

Lupusonwork commented 2 years ago

$job=Get-VBRJob -name XXXXX $job.ScheduleOptions.NextRun -eq '' > True

ghost commented 2 years ago

To correct this, within static [int]GetNextBackupStartTimeInSeconds($nextRun) in line 747, change the first if statement from if($nextRun -eq "01/01/0001 00:00:00") to if($nextRun -eq "01/01/0001 00:00:00" -or [string]::IsNullOrEmpty($nextRun)) - just like in static [string]GetNextBackupStartTimeText($nextRun).

For others looking for this error: Message in English is "An exception occurred while trying to process backups: String was not recognized as a valid DateTime."