Random Project

Wrote some modifications

With my regional seetings I had to modify the script, I also added some performance datas. The modifications do start afet line 48 :

$now = (Get-Date).AddDays(-$period)
$lastend = (Get-BEJobHistory -Name $name -FromLastJobRun).EndTime.ToString(“dd.MM.yyyy HH:mm”)
$laststart = (Get-BEJobHistory -Name $name -FromLastJobRun).StartTime
$jobsize = (Get-BEJobHistory -Name $name -FromLastJobRun).TotalDataSizeBytes/1000000000
$jobsize = “{0:N0}” -f $jobsize
$jobduration = (Get-BEJobHistory -Name $name -FromLastJobRun).ElapsedTime.Hours*60 +(Get-BEJobHistory -Name $name -FromLastJobRun).ElapsedTime.Minutes
$name = ” + $name + ”

if ($now -gt $laststart)
{
Write-Host “CRITICAL! Last run of job: $name on $lastend.”
exit 2
}
else
{
$jobsize=$jobsize+”B”
Write-Host “OK Job $name ($jobsize GB) completed successfully on $lastend in $jobduration minutes.|Job_size=$jobsize; Duration_minutes=$jobduration”
exit 0
}