diff --git a/Get-BackupCapacityPlanningData.ps1 b/Get-BackupCapacityPlanningData.ps1 index 3322850..634a4f9 100644 --- a/Get-BackupCapacityPlanningData.ps1 +++ b/Get-BackupCapacityPlanningData.ps1 @@ -73,16 +73,33 @@ ForEach ( $plan in $BackupPlans ) { [System.Collections.Hashtable]$FilteredFiles = @{} [System.Collections.Hashtable]$IncludedFiles = @{} - # Get all included items - ForEach ( $obj in $plan.Items ) { - ForEach ( $path in $obj.PlanItem.Path ) { + # Get all included items from older plan format + If ( $null -ne $plan.Items ) { + ForEach ( $obj in $plan.Items ) { + ForEach ( $path in $obj.PlanItem.Path ) { + Use-Path -List $IncludedPaths -Path $path + } + } + } + # Get all included items from newer plan format + If ( $null -ne $plan.BackupItem ) { + ForEach ( $path in $plan.BackupItem ) { Use-Path -List $IncludedPaths -Path $path } + } + + # Get all excluded items from older plan format + If ( $null -ne $plan.ExcludedItems ) { + ForEach ( $obj in $plan.ExcludedItems ) { + ForEach ( $path in $obj.PlanItem.Path ) { + Use-Path -List $ExcludedPaths -Path $path + } + } } - # Get all excluded items - ForEach ( $obj in $plan.ExcludedItems ) { - ForEach ( $path in $obj.PlanItem.Path ) { + # Get all excluded items from newer plan format + If ( $null -ne $plan.ExcludeItem ) { + ForEach ( $path in $plan.ExcludeItem ) { Use-Path -List $ExcludedPaths -Path $path } }