more testing

This commit is contained in:
2024-02-22 23:32:45 -05:00
parent 71affea1fb
commit f31eb48556
+14
View File
@@ -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"
}