Skip to content

Commit 2b369db

Browse files
committed
reduce backup size by not including completed tasks
1 parent 019d889 commit 2b369db

1 file changed

Lines changed: 6 additions & 1 deletion

File tree

Modules/CIPPCore/Public/New-CIPPBackup.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,12 @@ function New-CIPPBackup {
6060
)
6161
$CSVfile = foreach ($CSVTable in $BackupTables) {
6262
$Table = Get-CippTable -tablename $CSVTable
63-
Get-AzDataTableEntity @Table | Select-Object * -ExcludeProperty DomainAnalyser, table, Timestamp, ETag, Results | Select-Object *, @{l = 'table'; e = { $CSVTable } }
63+
$Entities = if ($CSVTable -eq 'ScheduledTasks') {
64+
Get-AzDataTableEntity @Table -Filter "TaskState ne 'Completed'"
65+
} else {
66+
Get-AzDataTableEntity @Table
67+
}
68+
$Entities | Select-Object * -ExcludeProperty DomainAnalyser, table, Timestamp, ETag, Results | Select-Object *, @{l = 'table'; e = { $CSVTable } }
6469
}
6570
$RowKey = 'CIPPBackup' + '_' + (Get-Date).ToString('yyyy-MM-dd-HHmm')
6671
$BackupData = [string]($CSVfile | ConvertTo-Json -Compress -Depth 100)

0 commit comments

Comments
 (0)