Skip to content

Commit 07e14d4

Browse files
remove logging
1 parent 233b0c0 commit 07e14d4

File tree

2 files changed

+163
-226
lines changed

2 files changed

+163
-226
lines changed

Modules/CIPPCore/Public/Entrypoints/Activity Triggers/Standards/Push-CIPPDriftManagement.ps1

Lines changed: 28 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -36,58 +36,37 @@ function Push-CippDriftManagement {
3636
}
3737

3838
$GenerateEmail = New-CIPPAlertTemplate -format 'html' -data $Data -CIPPURL $CIPPURL -Tenant $Item.Tenant -InputObject 'driftStandard' -AuditLogLink $drift.standardId
39-
40-
# Measure email alert sending
41-
Measure-CippTask -TaskName 'DriftEmailAlert' -EventName 'CIPP.DriftStatus' -Metadata @{
42-
Tenant = $Item.Tenant
43-
Section = 'EmailAlert'
44-
} -Script {
45-
$CIPPAlert = @{
46-
Type = 'email'
47-
Title = $GenerateEmail.title
48-
HTMLContent = $GenerateEmail.htmlcontent
49-
TenantFilter = $Item.Tenant
50-
}
51-
Write-Host 'Going to send the mail'
52-
Send-CIPPAlert @CIPPAlert -altEmail $email
39+
$CIPPAlert = @{
40+
Type = 'email'
41+
Title = $GenerateEmail.title
42+
HTMLContent = $GenerateEmail.htmlcontent
43+
TenantFilter = $Item.Tenant
5344
}
54-
55-
# Measure webhook alert sending
56-
Measure-CippTask -TaskName 'DriftWebhookAlert' -EventName 'CIPP.DriftStatus' -Metadata @{
57-
Tenant = $Item.Tenant
58-
Section = 'WebhookAlert'
59-
} -Script {
60-
$WebhookData = @{
61-
Title = $GenerateEmail.title
62-
ActionUrl = $GenerateEmail.ButtonUrl
63-
ActionText = $GenerateEmail.ButtonText
64-
AlertData = $Data
65-
Tenant = $Item.Tenant
66-
} | ConvertTo-Json -Depth 15 -Compress
67-
$CippAlert = @{
68-
Type = 'webhook'
69-
Title = $GenerateEmail.title
70-
JSONContent = $WebhookData
71-
TenantFilter = $Item.Tenant
72-
}
73-
Write-Host 'Sending Webhook Content'
74-
Send-CIPPAlert @CippAlert -altWebhook $webhook
45+
Write-Host 'Going to send the mail'
46+
Send-CIPPAlert @CIPPAlert -altEmail $email
47+
$WebhookData = @{
48+
Title = $GenerateEmail.title
49+
ActionUrl = $GenerateEmail.ButtonUrl
50+
ActionText = $GenerateEmail.ButtonText
51+
AlertData = $Data
52+
Tenant = $Item.Tenant
53+
} | ConvertTo-Json -Depth 15 -Compress
54+
$CippAlert = @{
55+
Type = 'webhook'
56+
Title = $GenerateEmail.title
57+
JSONContent = $WebhookData
58+
TenantFilter = $Item.Tenant
7559
}
76-
77-
# Measure PSA alert sending
78-
Measure-CippTask -TaskName 'DriftPSAAlert' -EventName 'CIPP.DriftStatus' -Metadata @{
79-
Tenant = $Item.Tenant
80-
Section = 'PSAAlert'
81-
} -Script {
82-
#Always do PSA.
83-
$CIPPAlert = @{
84-
Type = 'psa'
85-
Title = $GenerateEmail.title
86-
HTMLContent = $GenerateEmail.htmlcontent
87-
TenantFilter = $Item.Tenant
88-
}
89-
Send-CIPPAlert @CIPPAlert
60+
Write-Host 'Sending Webhook Content'
61+
Send-CIPPAlert @CippAlert -altWebhook $webhook
62+
#Always do PSA.
63+
$CIPPAlert = @{
64+
Type = 'psa'
65+
Title = $GenerateEmail.title
66+
HTMLContent = $GenerateEmail.htmlcontent
67+
TenantFilter = $Item.Tenant
9068
}
69+
Send-CIPPAlert @CIPPAlert
9170
return $true
9271
} else {
9372
Write-LogMessage -API 'DriftStandards' -tenant $Item.Tenant -message "No new drift deviations found for tenant $($Item.Tenant)" -sev Info

0 commit comments

Comments
 (0)