We have 6 Veeam Jobs each containing about 10 or so servers. What I am trying to do eventually in PowerShell is create a script that will run once a day and delete oracle archive redo logs if the backup job for the server was successful. If it is unsuccessful I want it to send an e-mail or something like that.
Anyway I am failing at the first hurdle which is to get a list of servers who's backup have failed.
what I can't seem to do is list which server(s) in the group of 10 or so was the one(s) that failed. I dont see a method for Get-VBRJobObject that will tell me.
This is a mostly a learning exercise (new to PowerShell) for me and I really appreciate the help. Just have one more question. I am now trying to get an e-mail sent for each failed VM. I get e-mail fine but the $srv.Name is not being passed to the -Body argument properly.
Don't worry. I have figured it out. I don't think the -Body argument liked having a variable property so I just created a new variable to hold it. Send message bit looks like this now:
Okay, I have a job with 5 servers in. One of the servers in the job fails causing the .GetLastResult of Get-VBRJob to equal "Failed". How do I list the servers in that Job that completed successfully.
asnp VeeamPSSnapin
$Job = Get-VBRJob -name "Name of your job"
$Session = $Job.FindLastSession()
$Session.GetTaskSessionsByStatus("Success")
I should find one server as we have a Job where one server has failed and the other one is successful. I also tried with the loop but again got no results:
So, if i were you, I’d doublecheck whether the given job failed during the last session and whether the VM you're talking about was backed up successfully during this session.
Ah Ok. I think I have seen why it's not working for me. The first time the job runs the two servers run, one fails the other is successful. Then the job retries the failed server 3 times. This means that the last session for that job only the failed server runs (and fails).
This script takes all backup sessions that have failed during the day and lists VMs that have been backed up successfully within them. However, under certain circumstances there might be a sight effect that some VM will be listed several times.
We're using B&R 8 with latest SP and Windows 2012 Standard Server.
What I'm trying is to get a list of all failed VMs with the Veeam PSSnapin, we solved it so far that we'll getting a list of all failed VMs but with lots of information. We only need the Names of the failed ones. Is that possible with power shell? We're not very familiar with power shell..
Can't comment on the PowerShell script examples, but if you're not very familiar with scripting, you can use Veeam ONE (part of Availability Suite) to report on failed VMs automatically through predefined report templates.
The latest script provided by me lists only VM names and failure reasons. If you don't want the latter information, feel free to remove $FailedVM.info.reason. Or you're saying that the script doesn't work in your case?