Skip to content

Commit 158663e

Browse files
committed
Update Start-DurableCleanup.ps1
1 parent f4cbdc3 commit 158663e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

Modules/CIPPCore/Public/Entrypoints/Timer Functions/Start-DurableCleanup.ps1

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,11 @@ function Start-DurableCleanup {
4949
if ($PSCmdlet.ShouldProcess($_.PartitionKey, 'Terminate Orchestrator')) {
5050
$Orchestrator = Get-CIPPAzDataTableEntity @Table -Filter "PartitionKey eq '$($Orchestrator.PartitionKey)'"
5151
$Orchestrator.RuntimeStatus = 'Failed'
52-
$Orchestrator.CustomStatus = "Terminated by Durable Cleanup - Exceeded max duration of $MaxDuration seconds"
52+
if ($Orchestrator.PSObject.Properties.Name -contains 'CustomStatus') {
53+
$Orchestrator.CustomStatus = "Terminated by Durable Cleanup - Exceeded max duration of $MaxDuration seconds"
54+
} else {
55+
$Orchestrator | Add-Member -MemberType NoteProperty -Name CustomStatus -Value "Terminated by Durable Cleanup - Exceeded max duration of $MaxDuration seconds"
56+
}
5357
Update-AzDataTableEntity @Table -Entity $Orchestrator
5458
$CleanupCount++
5559
}

0 commit comments

Comments
 (0)