Skip to content

Commit 1a5859d

Browse files
authored
Merge pull request #908 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents c61dc7b + cb4c25a commit 1a5859d

25 files changed

Lines changed: 71 additions & 25 deletions

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ function Get-CIPPAlertAdminPassword {
3838
$AlertData = @()
3939
}
4040

41-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
41+
if ($AlertData) {
42+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
43+
}
4244
} catch {
4345
Write-LogMessage -API 'Alerts' -tenant $($TenantFilter) -message "Could not get admin password changes for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)" -sev Error
4446
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ function Get-CIPPAlertApnCertExpiry {
1616
$AlertData = if ($Apn.expirationDateTime -lt (Get-Date).AddDays(30) -and $Apn.expirationDateTime -gt (Get-Date).AddDays(-7)) {
1717
$Apn | Select-Object -Property appleIdentifier, expirationDateTime
1818
}
19-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
19+
if ($AlertData) {
20+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
21+
}
2022

2123
} catch {
2224
#no error because if a tenant does not have an APN, it'll error anyway.

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,5 +61,7 @@ function Get-CIPPAlertAppCertificateExpiry {
6161
@($AppAlertData)
6262
@($SamlAlertData)
6363
) | Where-Object { $null -ne $_ }
64-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
64+
if ($AlertData) {
65+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
66+
}
6567
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,5 +40,7 @@ function Get-CIPPAlertAppSecretExpiry {
4040
}
4141
}
4242
}
43-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
43+
if ($AlertData) {
44+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
45+
}
4446
}

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@ function Get-CIPPAlertDefenderAlerts {
4949
Tenant = $TenantFilter
5050
}
5151
}
52-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
52+
if ($AlertData) {
53+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
54+
}
5355

5456
} catch {
5557
# Commented out due to potential licensing spam

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ function Get-CIPPAlertDefenderIncidents {
3636
Tenant = $TenantFilter
3737
}
3838
}
39-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
39+
if ($AlertData) {
40+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
41+
}
4042

4143
} catch {
4244
# Pretty sure this one is gonna be spammy cause of licensing issues, so it's commented out -Bobby

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,9 @@ function Get-CIPPAlertDefenderMalware {
2727
TenantId = $_.tenantId
2828
}
2929
}
30-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
30+
if ($AlertData) {
31+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
32+
}
3133

3234
} catch {
3335
Write-LogMessage -API 'Alerts' -tenant $($TenantFilter) -message "Could not get malware data for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)" -sev Error

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ function Get-CIPPAlertDefenderStatus {
2626
TenantId = $_.tenantId
2727
}
2828
}
29-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
29+
if ($AlertData) {
30+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
31+
}
3032

3133
} catch {
3234
Write-LogMessage -API 'Alerts' -tenant $($TenantFilter) -message "Could not get defender status for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)" -sev Error

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@ function Get-CIPPAlertDepTokenExpiry {
2020
$Dep | Select-Object -Property tokenName, @{Name = 'Message'; Expression = { $Message } }
2121
}
2222
}
23-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
23+
if ($AlertData) {
24+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
25+
}
2426

2527
} catch {}
2628

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ function Get-CIPPAlertDeviceCompliance {
1313
)
1414
try {
1515
$AlertData = New-GraphGETRequest -uri "https://graph.microsoft.com/v1.0/deviceManagement/managedDevices?`$filter=complianceState eq 'noncompliant'&`$select=id,deviceName,managedDeviceOwnerType,complianceState,lastSyncDateTime&`$top=999" -tenantid $TenantFilter
16-
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
16+
if ($AlertData) {
17+
Write-AlertTrace -cmdletName $MyInvocation.MyCommand -tenantFilter $TenantFilter -data $AlertData
18+
}
1719
} catch {
1820
Write-LogMessage -API 'Alerts' -tenant $($TenantFilter) -message "Could not get compliance state for $($TenantFilter): $(Get-NormalizedError -message $_.Exception.message)" -sev Error
1921
}

0 commit comments

Comments
 (0)