Skip to content

Commit 2928cb3

Browse files
authored
Merge pull request #459 from KelvinTegelaar/dev
[pull] dev from KelvinTegelaar:dev
2 parents ae5c5e5 + 72c4d46 commit 2928cb3

File tree

2 files changed

+217
-0
lines changed

2 files changed

+217
-0
lines changed

Modules/CIPPCore/Public/Entrypoints/Invoke-PublicPhishingCheck.ps1

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ function Invoke-PublicPhishingCheck {
1919
} elseif ($Request.Body.source -and $Tenant) {
2020
$Message = "Alert received from $($Request.Body.source) for $($Request.body.TenantId)"
2121
Write-Information ($Request.Body | ConvertTo-Json)
22+
Write-AlertTrace -cmdletName 'CheckExtentionAlert' -tenantFilter $Tenant -data $Request.body
2223
Write-AlertMessage -message $Message -sev 'Alert' -tenant $Tenant.customerId -LogData $Request.body
2324
}
2425

Lines changed: 216 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,216 @@
1+
function Invoke-CIPPStandardDeployCheckChromeExtension {
2+
<#
3+
.FUNCTIONALITY
4+
Internal
5+
.COMPONENT
6+
(APIName) DeployCheckChromeExtension
7+
.SYNOPSIS
8+
(Label) Deploy Check Chrome Extension
9+
.DESCRIPTION
10+
(Helptext) Deploys the Check Chrome extension via Intune OMA-URI custom policies for both Chrome and Edge browsers with configurable settings. Chrome ID: benimdeioplgkhanklclahllklceahbe, Edge ID: knepjpocdagponkonnbggpcnhnaikajg
11+
(DocsDescription) Creates Intune OMA-URI custom policies that automatically install and configure the Check Chrome extension on managed devices for both Google Chrome and Microsoft Edge browsers. This ensures the extension is deployed consistently across all corporate devices with customizable settings.
12+
.NOTES
13+
CAT
14+
Intune Standards
15+
TAG
16+
ADDEDCOMPONENT
17+
IMPACT
18+
Low Impact
19+
ADDEDDATE
20+
2025-09-18
21+
POWERSHELLEQUIVALENT
22+
Set-CIPPIntunePolicy -TemplateType 'Device'
23+
RECOMMENDEDBY
24+
CIPP
25+
UPDATECOMMENTBLOCK
26+
Run the Tools\Update-StandardsComments.ps1 script to update this comment block
27+
.LINK
28+
https://docs.cipp.app/user-documentation/tenant/standards/list-standards
29+
#>
30+
31+
param($Tenant, $Settings)
32+
33+
# Check for required Intune license
34+
$TestResult = Test-CIPPStandardLicense -StandardName 'DeployCheckChromeExtension' -TenantFilter $Tenant -RequiredCapabilities @('INTUNE_A', 'MDM_Services', 'EMS', 'SCCM', 'MICROSOFTINTUNEPLAN1')
35+
36+
if ($TestResult -eq $false) {
37+
Set-CIPPStandardsCompareField -FieldName 'standards.DeployCheckChromeExtension' -FieldValue 'This tenant does not have the required license for this standard.' -Tenant $Tenant
38+
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'This tenant does not have the required license for this standard.' -sev Error
39+
return $true
40+
}
41+
42+
Write-Information "Running Deploy Check Chrome Extension standard for tenant $($Tenant)."
43+
44+
# Chrome and Edge extension IDs for the Check extension
45+
$ChromeExtensionId = 'benimdeioplgkhanklclahllklceahbe'
46+
$EdgeExtensionId = 'knepjpocdagponkonnbggpcnhnaikajg'
47+
48+
# Policy names
49+
$ChromePolicyName = 'Deploy Check Chrome Extension (Chrome)'
50+
$EdgePolicyName = 'Deploy Check Chrome Extension (Edge)'
51+
52+
# Get configuration values with defaults
53+
$ShowNotifications = $Settings.showNotifications ?? $true
54+
$EnableValidPageBadge = $Settings.enableValidPageBadge ?? $true
55+
$EnablePageBlocking = $Settings.enablePageBlocking ?? $true
56+
$EnableCippReporting = $Settings.enableCippReporting ?? $true
57+
$CippServerUrl = $Settings.cippServerUrl
58+
$CippTenantId = $Settings.cippTenantId
59+
$CustomRulesUrl = $Settings.customRulesUrl
60+
$UpdateInterval = $Settings.updateInterval ?? 24
61+
$EnableDebugLogging = $Settings.enableDebugLogging ?? $false
62+
$CompanyName = $Settings.companyName
63+
$ProductName = $Settings.productName
64+
$SupportEmail = $Settings.supportEmail
65+
$PrimaryColor = $Settings.primaryColor ?? '#F77F00'
66+
$LogoUrl = $Settings.logoUrl
67+
68+
# Create extension settings JSON
69+
$ChromeExtensionSettings = @{
70+
$ChromeExtensionId = @{
71+
installation_mode = 'force_installed'
72+
update_url = 'https://clients2.google.com/service/update2/crx'
73+
settings = @{
74+
showNotifications = $ShowNotifications
75+
enableValidPageBadge = $EnableValidPageBadge
76+
enablePageBlocking = $EnablePageBlocking
77+
enableCippReporting = $EnableCippReporting
78+
cippServerUrl = $CippServerUrl
79+
cippTenantId = $CippTenantId
80+
customRulesUrl = $CustomRulesUrl
81+
updateInterval = $UpdateInterval
82+
enableDebugLogging = $EnableDebugLogging
83+
customBranding = @{
84+
companyName = $CompanyName
85+
productName = $ProductName
86+
supportEmail = $SupportEmail
87+
primaryColor = $PrimaryColor
88+
logoUrl = $LogoUrl
89+
}
90+
}
91+
}
92+
} | ConvertTo-Json -Depth 10
93+
94+
$EdgeExtensionSettings = @{
95+
$EdgeExtensionId = @{
96+
installation_mode = 'force_installed'
97+
update_url = 'https://edge.microsoft.com/extensionwebstorebase/v1/crx'
98+
settings = @{
99+
showNotifications = $ShowNotifications
100+
enableValidPageBadge = $EnableValidPageBadge
101+
enablePageBlocking = $EnablePageBlocking
102+
enableCippReporting = $EnableCippReporting
103+
cippServerUrl = $CippServerUrl
104+
cippTenantId = $CippTenantId
105+
customRulesUrl = $CustomRulesUrl
106+
updateInterval = $UpdateInterval
107+
enableDebugLogging = $EnableDebugLogging
108+
customBranding = @{
109+
companyName = $CompanyName
110+
productName = $ProductName
111+
supportEmail = $SupportEmail
112+
primaryColor = $PrimaryColor
113+
logoUrl = $LogoUrl
114+
}
115+
}
116+
}
117+
} | ConvertTo-Json -Depth 10
118+
119+
# Create Chrome OMA-URI policy JSON
120+
$ChromePolicyJSON = @{
121+
'@odata.type' = '#microsoft.graph.windows10CustomConfiguration'
122+
displayName = $ChromePolicyName
123+
description = 'Deploys and configures the Check Chrome extension for Google Chrome browsers'
124+
omaSettings = @(
125+
@{
126+
'@odata.type' = '#microsoft.graph.omaSettingString'
127+
displayName = 'Chrome Extension Settings'
128+
description = 'Configure Check Chrome extension settings'
129+
omaUri = './Device/Vendor/MSFT/Policy/Config/Chrome~Policy~googlechrome/ExtensionSettings'
130+
value = $ChromeExtensionSettings
131+
}
132+
)
133+
} | ConvertTo-Json -Depth 20
134+
135+
# Create Edge OMA-URI policy JSON
136+
$EdgePolicyJSON = @{
137+
'@odata.type' = '#microsoft.graph.windows10CustomConfiguration'
138+
displayName = $EdgePolicyName
139+
description = 'Deploys and configures the Check Chrome extension for Microsoft Edge browsers'
140+
omaSettings = @(
141+
@{
142+
'@odata.type' = '#microsoft.graph.omaSettingString'
143+
displayName = 'Edge Extension Settings'
144+
description = 'Configure Check Chrome extension settings'
145+
omaUri = './Device/Vendor/MSFT/Policy/Config/Edge/ExtensionSettings'
146+
value = $EdgeExtensionSettings
147+
}
148+
)
149+
} | ConvertTo-Json -Depth 20
150+
151+
try {
152+
# Check if the policies already exist
153+
$ExistingPolicies = New-GraphGetRequest -uri 'https://graph.microsoft.com/beta/deviceManagement/deviceConfigurations' -tenantid $Tenant
154+
$ChromePolicyExists = $ExistingPolicies.value | Where-Object { $_.displayName -eq $ChromePolicyName }
155+
$EdgePolicyExists = $ExistingPolicies.value | Where-Object { $_.displayName -eq $EdgePolicyName }
156+
157+
if ($Settings.remediate -eq $true) {
158+
# Handle assignment configuration
159+
$AssignTo = $Settings.AssignTo ?? 'AllDevices'
160+
$ExcludeGroup = $Settings.ExcludeGroup
161+
162+
# Handle custom group assignment
163+
if ($Settings.customGroup) {
164+
$AssignTo = $Settings.customGroup
165+
}
166+
167+
# Deploy Chrome policy
168+
if (-not $ChromePolicyExists) {
169+
$Result = Set-CIPPIntunePolicy -TemplateType 'Device' -Description 'Deploys and configures the Check Chrome extension for Google Chrome browsers' -DisplayName $ChromePolicyName -RawJSON $ChromePolicyJSON -AssignTo $AssignTo -ExcludeGroup $ExcludeGroup -tenantFilter $Tenant
170+
Write-LogMessage -API 'Standards' -tenant $Tenant -message "Successfully created Check Chrome Extension policy for Chrome: $ChromePolicyName" -sev Info
171+
} else {
172+
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Check Chrome Extension policy for Chrome already exists, skipping creation' -sev Info
173+
}
174+
175+
# Deploy Edge policy
176+
if (-not $EdgePolicyExists) {
177+
$Result = Set-CIPPIntunePolicy -TemplateType 'Device' -Description 'Deploys and configures the Check Chrome extension for Microsoft Edge browsers' -DisplayName $EdgePolicyName -RawJSON $EdgePolicyJSON -AssignTo $AssignTo -ExcludeGroup $ExcludeGroup -tenantFilter $Tenant
178+
Write-LogMessage -API 'Standards' -tenant $Tenant -message "Successfully created Check Chrome Extension policy for Edge: $EdgePolicyName" -sev Info
179+
} else {
180+
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Check Chrome Extension policy for Edge already exists, skipping creation' -sev Info
181+
}
182+
}
183+
184+
if ($Settings.alert -eq $true) {
185+
$BothPoliciesExist = $ChromePolicyExists -and $EdgePolicyExists
186+
if ($BothPoliciesExist) {
187+
Write-LogMessage -API 'Standards' -tenant $Tenant -message 'Check Chrome Extension policies are deployed for both Chrome and Edge' -sev Info
188+
} else {
189+
$MissingPolicies = @()
190+
if (-not $ChromePolicyExists) { $MissingPolicies += 'Chrome' }
191+
if (-not $EdgePolicyExists) { $MissingPolicies += 'Edge' }
192+
Write-StandardsAlert -message "Check Chrome Extension policies are missing for: $($MissingPolicies -join ', ')" -object @{ 'Missing Policies' = $MissingPolicies -join ',' } -tenant $Tenant -standardName 'DeployCheckChromeExtension' -standardId $Settings.standardId
193+
Write-LogMessage -API 'Standards' -tenant $Tenant -message "Check Chrome Extension policies are missing for: $($MissingPolicies -join ', ')" -sev Alert
194+
}
195+
}
196+
197+
if ($Settings.report -eq $true) {
198+
$StateIsCorrect = $ChromePolicyExists -and $EdgePolicyExists
199+
Set-CIPPStandardsCompareField -FieldName 'standards.DeployCheckChromeExtension' -FieldValue $StateIsCorrect -TenantFilter $Tenant
200+
Add-CIPPBPAField -FieldName 'DeployCheckChromeExtension' -FieldValue $StateIsCorrect -StoreAs bool -Tenant $Tenant
201+
}
202+
203+
} catch {
204+
$ErrorMessage = Get-NormalizedError -Message $_.Exception.Message
205+
Write-LogMessage -API 'Standards' -tenant $Tenant -message "Failed to deploy Check Chrome Extension policies. Error: $ErrorMessage" -sev Error
206+
207+
if ($Settings.alert -eq $true) {
208+
Write-StandardsAlert -message "Failed to deploy Check Chrome Extension policies: $ErrorMessage" -object @{ 'Error' = $ErrorMessage } -tenant $Tenant -standardName 'DeployCheckChromeExtension' -standardId $Settings.standardId
209+
}
210+
211+
if ($Settings.report -eq $true) {
212+
Set-CIPPStandardsCompareField -FieldName 'standards.DeployCheckChromeExtension' -FieldValue @{ 'Error' = $ErrorMessage } -TenantFilter $Tenant
213+
Add-CIPPBPAField -FieldName 'DeployCheckChromeExtension' -FieldValue $false -StoreAs bool -Tenant $Tenant
214+
}
215+
}
216+
}

0 commit comments

Comments
 (0)