Result value from Backup Copy Jobs is always none

PowerShell script exchange

Result value from Backup Copy Jobs is always none

Veeam Logoby aeccles » Wed Feb 05, 2014 10:54 pm

Whenever I run Get-VBRJob and look at my Backup Copy jobs the result is always "none"
Is there another place I can look to get the results of these jobs? I imagine it must be somewhere since the email alerts contain the information.

Thank you
aeccles
Enthusiast
 
Posts: 80
Liked: 6 times
Joined: Tue May 01, 2012 3:00 pm

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby v.Eremin » Thu Feb 06, 2014 8:20 am

Have you tried to use .GetLastResult() function?

Code: Select all
asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your backup copy job"
$Job.GetLastResult()


Thanks.
v.Eremin
Veeam Software
 
Posts: 13728
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED]:Result value from Backup Copy Jobs is always none

Veeam Logoby HvemVet » Wed Mar 23, 2016 9:17 am

How to get the result of a run copy job in powershell? If you use the regular parameter .GetLastResult() that give the correct status for a backup job, you get the answer "none" for a backup copy job,
like described in the thread linked below.
Is there another way to get the information whether last run finished correctly?

The reason for me wanting this information is because its easier to forget to check if the copy jobs are running like they should. :)

The previous a thread for this:
powershell-f26/result-value-from-backup-copy-jobs-is-always-none-t20512.html
HvemVet
Novice
 
Posts: 3
Liked: 1 time
Joined: Wed Mar 23, 2016 9:02 am
Full Name: Ola Danielsen

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby PTide » Wed Mar 23, 2016 10:33 am

Hi,

Please do not create duplicate topics. I've just checked GetLastResult() and it works fine. What PowerShell and VBR versions are you running? Also please double check if the backup copy job that you've specified in your script did actually run at least once.

Thank you.
PTide
Veeam Software
 
Posts: 3248
Liked: 272 times
Joined: Tue May 19, 2015 1:46 pm

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby HvemVet » Wed Mar 23, 2016 10:55 am

Sorry about that. The idea was to make the topic shorter and I forgot that before I submitted it. When I remembered shortly after it was not possible to change it as it was a while impossible to find the post while it was waiting to get published.
Many moderators do like new post in old threads that was why I did not post in that thread.

We are running VBR version 8, and Powershell v.3 (remoting with New-PSSession). Remember that these threads are not about backup jobs (which works fine with GetLastResult() ), but backup copy jobs. Yes, the backup copy job has run many times (with success).
HvemVet
Novice
 
Posts: 3
Liked: 1 time
Joined: Wed Mar 23, 2016 9:02 am
Full Name: Ola Danielsen

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby v.Eremin » Wed Mar 23, 2016 2:00 pm 1 person likes this post

If my memory serves me well, only running backup copy job has None as its status, neither disabled nor idling job has the same status.

So, you might want to a simple check to your script. If the job is running, take previous session instead the latest one and check its result.

Code: Select all
asnp VeeamPSSnapin
$BCJ = Get-VBRJob -name "Name of your backup copy job"
if ($BCJ.GetLastResult() -ne "None"){$BCJ.GetLastResult()}
else {(Get-VBRBackupSession -Name $BCJ.name | sort -Descending)[1].Result}


Thanks.
v.Eremin
Veeam Software
 
Posts: 13728
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby HvemVet » Tue Mar 29, 2016 8:49 am 1 person likes this post

Thank you very much! Get-VBRBackupSession solves this. :D

Then it will be:

Code: Select all
Get-VBRBackupSession | Where-Object {$_.OrigJobName -eq "Name of your copy job"}| Select-Object OrigJobName,EndTime,Result


or if you want it displayed nicely:

Code: Select all
Get-VBRBackupSession | Where-Object {$_.OrigJobName -eq "Name of your copy job" -and $_.EndTime -ge (Get-Date).adddays(-7)}| Select-Object OrigJobName,EndTime,Result|ft
HvemVet
Novice
 
Posts: 3
Liked: 1 time
Joined: Wed Mar 23, 2016 9:02 am
Full Name: Ola Danielsen

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby v.Eremin » Tue Mar 29, 2016 2:56 pm

You're welcome. If other questions arise, let me know. Thanks.
v.Eremin
Veeam Software
 
Posts: 13728
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] Monitoring script

Veeam Logoby Aumatics » Fri Oct 14, 2016 12:11 pm

Hi,

I am working at a script which i can include in our monitoring tool prtg to check if the backups are having problems.

I come pretty far with get-vbrjobs and getting the "GetLastResult" value, but that does not work for Backup Copy Jobs and Cloud Backups, because they don't have a lastResult as they are continues backups. I am looking for a way to check if the backup copy jobs and Cloud Backups have a warning or error but i cant find it.

Does someone know how we can get this
Aumatics
Lurker
 
Posts: 1
Liked: never
Joined: Fri Oct 14, 2016 11:59 am
Full Name: Aumatics

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby v.Eremin » Fri Oct 14, 2016 12:41 pm

Check the script provided above; should meet answer requirements. Thanks.
v.Eremin
Veeam Software
 
Posts: 13728
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

[MERGED] Backup Copy Job Newest Result

Veeam Logoby tdewin » Mon Oct 24, 2016 2:12 pm

It seems that if you use "get-vbrbackupsession" to query the last (newest) backup copy job session, the status will be always None (since the job is running in idle state/100% Progress but not done), even if everything is copied successfully. Is there any field/method that can be called to check "successful"-ness, or is the only way to do it by calculating yourself based on the VM result/100% Progress ?

For example (2 last sessions):
Code: Select all
$jobtype = "BackupSync"
#$jobtype = "Backup"
$Jobs = @(Get-VBRJob | ? { $_.JobType -ieq $jobtype }) | Sort-Object -Property Name

$allsessions = Get-VBRBackupSession | ? { $_.jobtype -ieq $jobtype }
$allorderdedsess = $allsessions | Sort-Object -Property CreationTimeUTC -Descending 

foreach ($Job in $Jobs) {
     $lastsessions = $allorderdedsess | ? { $_.jobname -eq $Job.Name } | select -First 2
     if ($lastsessions -ne $null) {
        $lastsessions | % {
                  $lastsession = $_;
                  write-host ("Name : {0} Last Result : {1}  Date : {2}" -f $Job.Name,$lastsession.Result,$lastsession.CreationTime)
         }
     } else {
           write-host ("Could not find Session for {0}" -f $Job.Name)
     }



Result
Name : Endpoint Backup Copy to Cloud Connect Last Result : None Date : 10/23/2016 10:00:36 PM
Name : Endpoint Backup Copy to Cloud Connect Last Result : Success Date : 10/22/2016 10:00:28 PM
Name : Hyper-V - Backup Copy to StoreOnce Last Result : None Date : 10/23/2016 10:04:08 PM
Name : Hyper-V - Backup Copy to StoreOnce Last Result : Failed Date : 10/22/2016 10:06:25 PM
Name : VMware - Backup Copy to Cloud Connect Last Result : None Date : 10/23/2016 10:00:36 PM
Name : VMware - Backup Copy to Cloud Connect Last Result : Success Date : 10/22/2016 10:00:28 PM
Name : VMware - Backup Copy to Cloud Connect with WAN Acceleration Last Result : None Date : 10/23/2016 10:00:09 PM
Name : VMware - Backup Copy to Cloud Connect with WAN Acceleration Last Result : Success Date : 10/22/2016 10:00:28 PM
Name : VMware - Backup Copy to DataDomain Last Result : None Date : 10/23/2016 10:00:09 PM
Name : VMware - Backup Copy to DataDomain Last Result : Success Date : 10/22/2016 10:00:28 PM
Name : VMware - Backup Copy to ExaGrid Last Result : None Date : 10/23/2016 10:00:09 PM
Name : VMware - Backup Copy to ExaGrid Last Result : Success Date : 10/22/2016 10:00:28 PM
Name : VMware - Backup Copy to StoreOnce Last Result : None Date : 10/23/2016 10:00:36 PM
Name : VMware - Backup Copy to StoreOnce Last Result : Success Date : 10/22/2016 10:00:28 PM
PS C:\Windows\system32>
tdewin
Veeam Software
 
Posts: 1110
Liked: 391 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby v.Eremin » Mon Oct 24, 2016 2:18 pm

Why not to query a previous session if current one is in idle state? You cannot say anything definitive about session that hasn't finished yet. Thanks.
v.Eremin
Veeam Software
 
Posts: 13728
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby tdewin » Mon Oct 24, 2016 3:24 pm

Well the strange thing is, if you push the report (manually/gui/no-powershell) button in the ribbon, it will flag the session as Success. Also strange is that in case it is finished but Idle, the endtime will be different then 1/1/1900 12:00:00 AM

So I guess the only way to mimic this behaviour is:
-check all VMs status (if there is non pending)
-check the details per vm (messages)
-check the job details (messages)
-check if job status is none
-check if endtime is bigger then creationtime
-check if Progress.Percent is 100%
-check if Job is Idle
tdewin
Veeam Software
 
Posts: 1110
Liked: 391 times
Joined: Fri Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin

Re: Result value from Backup Copy Jobs is always none

Veeam Logoby v.Eremin » Tue Oct 25, 2016 8:50 am

I still think that it would be easier to either output these sessions in the report as idle ones or to take previous ones instead. However, if it's crucial for you to imitate Report button behaviour, you can stick to the described approach.
v.Eremin
Veeam Software
 
Posts: 13728
Liked: 1027 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 1 guest