Skip to content

Commit b4009bc

Browse files
Merge pull request KelvinTegelaar#1874 from Zacgoose/backup-tweak
Backup Tweak :)
2 parents 10349fd + 3ecd17c commit b4009bc

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

Modules/CIPPCore/Public/Entrypoints/HTTP Functions/CIPP/Core/Invoke-ExecSetCIPPAutoBackup.ps1

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ function Invoke-ExecSetCIPPAutoBackup {
1010
$unixtime = [int64](([datetime]::UtcNow) - (Get-Date '1/1/1970')).TotalSeconds
1111
if ($Request.Body.Enabled -eq $true) {
1212
$Table = Get-CIPPTable -TableName 'ScheduledTasks'
13-
$AutomatedCIPPBackupTask = Get-AzDataTableEntity @table -Filter "Name eq 'Automated CIPP Backup'"
14-
$task = @{
15-
RowKey = $AutomatedCIPPBackupTask.RowKey
16-
PartitionKey = 'ScheduledTask'
13+
$AutomatedCIPPBackupTask = Get-AzDataTableEntity @table -Filter "Name eq 'Automated CIPP Backup'" -Property RowKey, PartitionKey, ETag
14+
if ($AutomatedCIPPBackupTask) {
15+
Remove-AzDataTableEntity -Force @Table -Entity $AutomatedCIPPBackupTask | Out-Null
1716
}
18-
Remove-AzDataTableEntity -Force @Table -Entity $task | Out-Null
1917

2018
$TaskBody = [pscustomobject]@{
2119
TenantFilter = 'PartnerTenant'

0 commit comments

Comments
 (0)