PowerShell script exchange
Post Reply
shahn
Influencer
Posts: 18
Liked: 2 times
Joined: Sep 04, 2023 7:48 am
Contact:

i want to get backup report everyday.

Post by shahn »

i want to get backup report every on [Application Plug-ins]

i used this script, but not run

Code: Select all

$job1= Get-VBRPluginJob | Where-Object {$_.Type -eq "Backup" -and $_.PluginType -like "SQL" -and $_.LastRun -ge (Get-Date).addhours(-24) }
foreach ($sessions in $job1) {
	$jname1 = Get-VBRPluginJob -Name "$($sessions.Name)" 
	$plugsess =[Veeam.Backup.Core.CBackupSession]::GetAllSessionsByPolicyJob($jname1.id) | Where-Object {$_.EndTime -ge (Get-Date).addhours(-24)
	}
	foreach ($session in $plugsess) {
		$session.gettasksessions()| Select-Object -Property Name,jobname,status,@{n='StartTime';e={$_.Progress.StartTimeLocal}}, @{n='EndTime';e={$_.Progress.StopTimeLocal}},@{n='TransferedSizeinMB';e={[math]::Round(($_.Progress.TransferedSize/1048576),2)}}
	}
}
[Moderator: Edited and formatted code to read a bit nicer]

Image
give me advice.
Thank you
shahn
Influencer
Posts: 18
Liked: 2 times
Joined: Sep 04, 2023 7:48 am
Contact:

Re: i want to get backup report everyday.

Post by shahn »

i want get report by Powershell script
benthomas
Veeam Vanguard
Posts: 66
Liked: 23 times
Joined: Apr 22, 2013 2:29 am
Full Name: Ben Thomas
Location: New Zealand
Contact:

Re: i want to get backup report everyday.

Post by benthomas »

Do you get any error messages?
Ben Thomas | Solutions Advisor | Veeam Vanguard 2023-2025 | VMCE | Microsoft MVP 2018-2024 | BCThomas.com
david.domask
Veeam Software
Posts: 2750
Liked: 630 times
Joined: Jun 28, 2016 12:12 pm
Contact:

Re: i want to get backup report everyday.

Post by david.domask » 1 person likes this post

Hi shahn,

Agree with Ben here, we need to know errors or what's happening to help :)

But, your script is using unsupported methods (section 5.8~) and I do not advise using these unless you're prepared to research and learn them on your own and prepared for the potential risks.

With supported methods, you can just do:

Code: Select all

$PluginSess = Get-VBRPluginBackupSession -Name "some job name or part of the name with wild cards" | Sort -Property CreationTime -Descending
$AllPSessData = Get-VBRBackupSession -Id $PluginSess.id
$AllPSessData will now have full CBackupSession objects for your plugin backup sessions. Each of the CBackupSession can be further passed to Get-VBRTaskSession on the -Session parameter to get the further details.

Play with that a bit and see if you can get your script going.
David Domask | Product Management: Principal Analyst
Post Reply

Who is online

Users browsing this forum: No registered users and 7 guests