Skip to content

Commit dc0b936

Browse files
committed
track cleanup count
1 parent 006db9e commit dc0b936

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Maintenance/Push-TableCleanupTask.ps1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ function Push-TableCleanupTask {
2525
Write-Information "Table $Table not found"
2626
}
2727
}
28+
Write-Information "#### $($Type) task complete for $($Item.TableName)"
2829
} elseif ($Type -eq 'CleanupRule') {
2930
if ($Item.Where) {
3031
$Where = [scriptblock]::Create($Item.Where)
@@ -35,6 +36,8 @@ function Push-TableCleanupTask {
3536
$DataTableProps = $Item.DataTableProps | ConvertTo-Json | ConvertFrom-Json -AsHashtable
3637
$Table = Get-CIPPTable -tablename $Item.TableName
3738
$CleanupCompleted = $false
39+
40+
$RowsRemoved = 0
3841
do {
3942
Write-Information "Fetching entities from $($Item.TableName) with filter: $($DataTableProps.Filter)"
4043
try {
@@ -43,6 +46,7 @@ function Push-TableCleanupTask {
4346
Write-Information "Removing $($Entities.Count) entities from $($Item.TableName)"
4447
try {
4548
Remove-AzDataTableEntity @Table -Entity $Entities -Force
49+
$RowsRemoved += $Entities.Count
4650
if ($DataTableProps.First -and $Entities.Count -lt $DataTableProps.First) {
4751
$CleanupCompleted = $true
4852
}
@@ -59,9 +63,10 @@ function Push-TableCleanupTask {
5963
$CleanupCompleted = $true
6064
}
6165
} while (!$CleanupCompleted)
66+
Write-Information "#### $($Type) task complete for $($Item.TableName). Rows removed: $RowsRemoved"
6267
} else {
6368
Write-Warning "Unknown task type: $Type"
6469
}
6570
}
66-
Write-Information "#### $($Type) task complete"
71+
6772
}

0 commit comments

Comments
 (0)