Here is the script:
Code: Select all
#Requires -Version 4
#Requires -RunAsAdministrator
<#
.Synopsis
Simple Veeam report to expand on information from 'Veeam Backup Billing' report in VeeamOne
.Notes
Version: 0.1
Author: Joe Houghes
Modified Date: 2-27-2019
.EXAMPLE
Get-VMandDiskFilterDetails | Format-Table
.EXAMPLE
Get-VMandDiskFilterDetails | Export-Csv VM_DiskFilterDetails.csv -NoTypeInformation
#>
#Load the Veeam PSSnapin
<#
if (!(Get-PSSnapin -Name VeeamPSSnapIn -ErrorAction SilentlyContinue)) {
Add-PsSnapin -Name VeeamPSSnapIn
}
#>
function Get-VMandDiskFilterDetails{
$reportJobOutput = @()
$reportJobs = Get-VBRJob | Where-Object {$PSItem.JobType -eq 'Backup' -OR $PSItem.JobType -eq 'BackupSync' -AND $PSItem.BackupPlatform.Platform -eq 'EVmware'}
$repositories = Get-VBRBackupRepository | Select-Object Name,Id
foreach ($reportJob in $reportJobs) {
$currentBackup = Get-VBRBackup -Name $reportJob.Name
$currentRepo = $repositories | Where-Object -Property Id -eq -Value $currentBackup.RepositoryId
$currentJobVMs = $reportJob.GetViOijs() | Select-Object Name, @{n='JobName';e={$reportjob.Name}}, @{n='Mode'; e={$PSItem.DiskFilterInfo.Mode}}, @{n='Disks'; e={$PSItem.DiskFilterInfo.Disks}}
foreach ($currentVM in $currentJobVMs) {
$reportJobOutputObject = New-Object -TypeName PSCustomObject -Property @{
'BackupJob' = $reportJob.Name
'VMName' = $currentVM.Name
'Location' = $currentRepo.Name
'DiskMode' = $currentVM.Mode
'DisksSpecific' = $currentVM.Disks
}
$reportJobOutput += $reportJobOutputObject
}
}
Write-Output $reportJobOutput | Select-Object 'BackupJob','VMName','Location','DiskMode','DisksSpecific'
}