From f31eb48556f4d319362c0ba67974044fcf1eaad2 Mon Sep 17 00:00:00 2001 From: David Yoder Date: Thu, 22 Feb 2024 23:32:45 -0500 Subject: [PATCH] more testing --- Get-BackupCapacityPlanningData.ps1 | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/Get-BackupCapacityPlanningData.ps1 b/Get-BackupCapacityPlanningData.ps1 index c54db3b..3322850 100644 --- a/Get-BackupCapacityPlanningData.ps1 +++ b/Get-BackupCapacityPlanningData.ps1 @@ -32,6 +32,7 @@ Function Use-Path { # Import MSP360 module Import-MSP360Module +#Import-Module MSP360 # Get all backup plans $BackupPlans = Get-MBSBackupPlan -OutputType Full @@ -61,6 +62,7 @@ ForEach ( $plan in $BackupPlans ) { $FilteredFiles.Add($File.FullName, $File.Length) | Out-Null } + # Print the plan name that we're currently working on Write-Output ('Plan Name: {0}' -f ($plan.Name)) # Create array lists to store paths included in the plans @@ -85,6 +87,12 @@ ForEach ( $plan in $BackupPlans ) { } } + # Print all paths in $IncludedPaths + If ( $IncludedPaths.Length -gt 0 ) { + Write-Output "Paths to backup:" + ForEach ( $path in $IncludedPaths ) { Write-Output $path } + } + # Process each path in $IncludedPaths ForEach ($path in $IncludedPaths ) { @@ -102,12 +110,16 @@ ForEach ( $plan in $BackupPlans ) { If ( $item -is [System.IO.FileInfo] ) { ProcessFile $item } } } + + # Print total files and total size Write-Output ('Total Files: {0}' -f ($IncludedFiles.Count)) If ( $IncludedFiles.Count -gt 0 ) { $IncludedFilesSize = 0 ForEach ($len in $IncludedFiles.Values) { $IncludedFilesSize += $len} Write-Output $('Total size: {0}GB' -f [math]::Round(($IncludedFilesSize/1GB),2) ) } + + # Print total excluded files and, optionally, the total size of excluded files as well as their full path Write-Output ('Total Excluded Files: {0}' -f ($FilteredFiles.Count)) If ( $FilteredFiles.Count -gt 0 ) { $FilteredFilesSize = 0 @@ -118,5 +130,7 @@ ForEach ( $plan in $BackupPlans ) { Write-Output $file.Name } } + + # Print a newline after each plan Write-Output "`n" }