PowerShell script exchange
Post Reply
Suryanarayanan
Enthusiast
Posts: 25
Liked: 4 times
Joined: Jul 09, 2021 12:42 pm
Full Name: Suryanarayanan
Location: Bangalore India
Contact:

Powershell command to fetch the last 24 hours Copy job status

Post by Suryanarayanan »

Hi All,

We have below commands to fetch the last 24 hours copy jobs status.

*************************************************

# Fetch each backup copy job sessions from VBR for the last 24 hours

$vbrsessions = Get-VBRBackupSession -Name *Copy* | Where-Object {$_.EndTime -ge (Get-Date).addhours(-24)}

# Fetch each client session details from each backup job
$client = foreach ($session in $vbrsessions) {$session.gettasksessions()| Select Name, Jobname, Status, @{n='StartTime';e={$_.Progress.StartTimeLocal}}, @{n='EndTime';e={$_.Progress.StopTimeLocal}},@{n='TransferedSizeinMB';e={[math]::Round(($_.Progress.TransferedSize/1048576),2)}}}

****************************************************

But now we are getting the error message for the below command. What would be the issue and solution?

Get-VBRBackupSession -Name *Copy* | Where-Object {$_.EndTime -ge (Get-Date).addhours(-24)}


Error:
Get-VBRBackupSession : The read operation failed, see inner exception.
At line:1 char:1



Regards,
Surya
david.domask
Veeam Software
Posts: 2689
Liked: 621 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: Powershell command to fetch the last 24 hours Copy job status

Post by david.domask »

Hi Surya,

Looks like a technical issue, so a Support Case is required here. Please open a case and be sure to include logs for Veeam Support to review. (Use the 3rd radio button to export logs from hosts, select the Veeam server itself to export from)

The error itself looks like the configuration database returned an error during the query, I'm not confident at the moment that it's about your script, so let's see what Veeam Support finds.

Please share your case number once created. Thanks!
David Domask | Product Management: Principal Analyst
mjr.epicfail
Veeam Legend
Posts: 518
Liked: 145 times
Joined: Apr 22, 2022 12:14 pm
Full Name: Danny de Heer
Contact:

Re: Powershell command to fetch the last 24 hours Copy job status

Post by mjr.epicfail »

I can confirm the command "Get-VBRBackupSession -Name *Copy* | Where-Object {$_.EndTime -ge (Get-Date).addhours(-24)}" works with a MSSQL config db.

As David already mentioned, could be an issue in the software/bug or DB itself.
VMCE / Veeam Legend 2*
Suryanarayanan
Enthusiast
Posts: 25
Liked: 4 times
Joined: Jul 09, 2021 12:42 pm
Full Name: Suryanarayanan
Location: Bangalore India
Contact:

Re: Powershell command to fetch the last 24 hours Copy job status

Post by Suryanarayanan »

Get-VBRBackupSession -Name *Copy* | Where-Object {$_.EndTime -ge (Get-Date).addhours(-24)}- command is working with our more than 10 VBR servers. Its only problem with 3 VBR servers. I will check with Veeam support.

Thanks for your response
Post Reply

Who is online

Users browsing this forum: No registered users and 60 guests