Hi,
I need a script that will tell me how much data was transferred (backed up) in the previous week and then export it to a spreadsheet.
Can someone help me with this?
Thanks
Ernest
-
- Lurker
- Posts: 1
- Liked: never
- Joined: Jul 12, 2013 6:31 pm
- Full Name: Ernest S
- Contact:
-
- Product Manager
- Posts: 20400
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Export report to Excel
In the way I see it, the following script should meet your expectations:
Firstly, it will find backup sessions that have been created during the previous week. Then, it gets the total backup data size. Finally, it will create a .xlsx file and pass $backupsize parameter to a first cell. The Excel part is nothing but a sheer example, so feel free to modify it however you want.
Additionally, it might be worth taking a look at these topics regarding advanced PowerShell reporting:
http://forums.veeam.com/viewtopic.php?f=26&t=13422
http://forums.veeam.com/viewtopic.php?f=26&t=8925
Thanks.
Code: Select all
Asnp VeeamPSSnapin
$Backupsize = 0
Foreach ($Job in Get-VBRJob)
{
Foreach ($session in Get-VBRBackupSession -Name $Job.name | where {(((Get-date) - $_.CreationTime).days -le "7") })
{
$Backupsize = $Backupsize + $session.BackupStats.BackupSize
}
}
$excel = New-object -comobject Excel.Application
$excel.Visible = $false
$excel.DisplayAlerts = $false
$workbook = $excel.Workbooks.Add()
$sheet = $workbook.Worksheets.Item(1)
$sheet.Name = 'Backup Report'
$Cells = $sheet.cells
$Cells.item(1,1) = $Backupsize
$workbook.SaveAs('C:\temp\Backup Report.xlsx')
$workbook.Close()
$excel.Quit()
Firstly, it will find backup sessions that have been created during the previous week. Then, it gets the total backup data size. Finally, it will create a .xlsx file and pass $backupsize parameter to a first cell. The Excel part is nothing but a sheer example, so feel free to modify it however you want.
Additionally, it might be worth taking a look at these topics regarding advanced PowerShell reporting:
http://forums.veeam.com/viewtopic.php?f=26&t=13422
http://forums.veeam.com/viewtopic.php?f=26&t=8925
Thanks.
Who is online
Users browsing this forum: No registered users and 7 guests