Hi,
What I need is a Powershell script that gets the entire report of the backup job, and after I need to send by mail the errors.
The problem is that I don't want to send all the errors but just some of them, so I need something that gets the error code and filters it (I don't know, maybe by the code-error would be fine).
So, how can I filter errors by their error code?
-
- Novice
- Posts: 6
- Liked: never
- Joined: Oct 04, 2019 1:15 pm
- Full Name: AAAA
- Contact:
-
- VeeaMVP
- Posts: 705
- Liked: 376 times
- Joined: Jun 24, 2019 1:39 pm
- Full Name: Chris Arceneaux
- Location: Georgia, USA
- Contact:
Re: How to filter by error code from a PS report?
Welcome to the Veeam forums!
There is a similar post answering this question: powershell-f26/get-warning-failed-and-e ... 39599.html
TLDR; The code below will return the errors you're looking for. You can apply PowerShell filtering methods to the output to get your desired results.
There is a similar post answering this question: powershell-f26/get-warning-failed-and-e ... 39599.html
TLDR; The code below will return the errors you're looking for. You can apply PowerShell filtering methods to the output to get your desired results.
Code: Select all
asnp VeeamPSSnapin
$Sessions = Get-VBRBackupSession -Name "Job Name" | where {$_.Result -eq "Failed"}
foreach ($Session in $Sessions){
$Session[0].Logger.GetLog().updatedrecords | ?{$_.status -eq "EFailed"} | select title
}
-
- Novice
- Posts: 6
- Liked: never
- Joined: Oct 04, 2019 1:15 pm
- Full Name: AAAA
- Contact:
Re: How to filter by error code from a PS report?
Ok that could help me.
So the best way is to use this part of code, (which gets all kind of errors/failures) and apply a Powershell filter.
What I need now is the parameter I need to use to give to Powershell the error code, so I can make a filter.
So the best way is to use this part of code, (which gets all kind of errors/failures) and apply a Powershell filter.
What I need now is the parameter I need to use to give to Powershell the error code, so I can make a filter.
-
- VeeaMVP
- Posts: 705
- Liked: 376 times
- Joined: Jun 24, 2019 1:39 pm
- Full Name: Chris Arceneaux
- Location: Georgia, USA
- Contact:
Re: How to filter by error code from a PS report?
The code above provides the error in string format. You'll need to filter out the error(s) that you want to exclude/include based of of that string.
For example:

For example:

Who is online
Users browsing this forum: No registered users and 15 guests