Export report to Excel

PowerShell script exchange

Export report to Excel

Veeam Logoby ernest2010 » Fri Jul 12, 2013 6:36 pm


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?


Posts: 1
Liked: never
Joined: Fri Jul 12, 2013 6:31 pm
Full Name: Ernest S

Re: Export report to Excel

Veeam Logoby v.Eremin » Mon Jul 15, 2013 12:05 pm

In the way I see it, the following script should meet your expectations:

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')

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:


Veeam Software
Posts: 14019
Liked: 1051 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin

Return to PowerShell

Who is online

Users browsing this forum: No registered users and 1 guest