Skip to content

Commit 169f302

Browse files
authored
Merge pull request #667 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents 1b0cdab + 5c96f7b commit 169f302

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed

Modules/CIPPCore/Public/Add-CIPPScheduledTask.ps1

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,12 @@ function Add-CIPPScheduledTask {
4646
return "Could not run task: $ErrorMessage"
4747
}
4848
} else {
49-
# Generate RowKey early to use in duplicate check
5049
if (!$Task.RowKey) {
5150
$RowKey = (New-Guid).Guid
5251
} else {
5352
$RowKey = $Task.RowKey
5453
}
5554

56-
# Check for duplicate RowKey (prevents race conditions)
57-
$Filter = "PartitionKey eq 'ScheduledTask' and RowKey eq '$RowKey'"
58-
$ExistingTaskByKey = (Get-CIPPAzDataTableEntity @Table -Filter $Filter)
59-
if ($ExistingTaskByKey) {
60-
return "Task with ID $RowKey already exists"
61-
}
62-
6355
if ($DisallowDuplicateName) {
6456
$Filter = "PartitionKey eq 'ScheduledTask' and Name eq '$($Task.Name)'"
6557
$ExistingTask = (Get-CIPPAzDataTableEntity @Table -Filter $Filter)
@@ -125,7 +117,6 @@ function Add-CIPPScheduledTask {
125117
$AdditionalProperties = ([PSCustomObject]$AdditionalProperties | ConvertTo-Json -Compress)
126118
if ($Parameters -eq 'null') { $Parameters = '' }
127119

128-
# RowKey already generated during duplicate check above
129120

130121
$Recurrence = if ([string]::IsNullOrEmpty($task.Recurrence.value)) {
131122
$task.Recurrence

Modules/CIPPCore/Public/Alerts/Get-CIPPAlertMXRecordChanged.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,10 @@ function Get-CIPPAlertMXRecordChanged {
1818

1919
$ChangedDomains = foreach ($Domain in $DomainData) {
2020
$PreviousDomain = $PreviousResults | Where-Object { $_.Domain -eq $Domain.Domain }
21-
if ($PreviousDomain -and $PreviousDomain.ActualMXRecords -ne $Domain.ActualMXRecords) {
22-
"$($Domain.Domain): MX records changed from [$($PreviousDomain.ActualMXRecords -join ', ')] to [$($Domain.ActualMXRecords -join ', ')]"
21+
$PreviousRecords = $PreviousDomain.ActualMXRecords -split ',' | Sort-Object
22+
$CurrentRecords = $Domain.ActualMXRecords.Hostname | Sort-Object
23+
if ($PreviousDomain -and $PreviousRecords -ne $CurrentRecords) {
24+
"$($Domain.Domain): MX records changed from [$($PreviousRecords -join ', ')] to [$($CurrentRecords -join ', ')]"
2325
}
2426
}
2527

@@ -29,11 +31,12 @@ function Get-CIPPAlertMXRecordChanged {
2931

3032
# Update cache with current data
3133
foreach ($Domain in $DomainData) {
34+
$CurrentRecords = $Domain.ActualMXRecords.Hostname | Sort-Object
3235
$CacheEntity = @{
3336
PartitionKey = [string]$TenantFilter
3437
RowKey = [string]$Domain.Domain
3538
Domain = [string]$Domain.Domain
36-
ActualMXRecords = [string]$Domain.ActualMXRecords
39+
ActualMXRecords = [string]($CurrentRecords -join ',')
3740
LastRefresh = [string]$Domain.LastRefresh
3841
MailProvider = [string]$Domain.MailProvider
3942
}

0 commit comments

Comments
 (0)