File tree Expand file tree Collapse file tree
Modules/CIPPCore/Public/Entrypoints/HTTP Functions/Endpoint/MEM Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -35,8 +35,14 @@ Function Invoke-AddDefenderDeployment {
3535 iosMobileApplicationManagementEnabled = [bool ]$Compliance.appSync
3636 microsoftDefenderForEndpointAttachEnabled = [bool ]$true
3737 } | ConvertTo-Json - Compress
38- $SettingsRequest = New-GraphPOSTRequest - uri ' https://graph.microsoft.com/beta/deviceManagement/mobileThreatDefenseConnectors/' - tenantid $tenant - type POST - body $SettingsObj - AsApp $true
39- " $ ( $Tenant ) : Successfully set Defender Compliance and Reporting settings"
38+ $ExistingSettings = New-GraphGETRequest - uri ' https://graph.microsoft.com/beta/deviceManagement/mobileThreatDefenseConnectors/fc780465-2017-40d4-a0c5-307022471b92' - tenantid $tenant
39+ if ($ExistingSettings ) {
40+ " Defender Intune Configuration already active for $ ( $Tenant ) . Skipping"
41+ } else {
42+ $SettingsRequest = New-GraphPOSTRequest - uri ' https://graph.microsoft.com/beta/deviceManagement/mobileThreatDefenseConnectors/' - tenantid $tenant - type POST - body $SettingsObj - AsApp $true
43+ " $ ( $Tenant ) : Successfully set Defender Compliance and Reporting settings"
44+ }
45+
4046
4147 $Settings = switch ($PolicySettings ) {
4248 { $_.ScanArchives } {
@@ -210,7 +216,7 @@ Function Invoke-AddDefenderDeployment {
210216 settings = @ ($EDRSettings )
211217 }
212218 Write-Host ( $EDRbody )
213- $CheckExististingEDR = New-GraphGETRequest - uri ' https://graph.microsoft.com/beta/deviceManagement/configurationPolicies' - tenantid $tenant | Where-Object - Property Name -eq ' EDR Configuration'
219+ $CheckExististingEDR = New-GraphGETRequest - uri ' https://graph.microsoft.com/beta/deviceManagement/configurationPolicies' - tenantid $tenant | Where-Object - Property Name -EQ ' EDR Configuration'
214220 if (' EDR Configuration' -in $CheckExististingEDR.Name ) {
215221 " $ ( $Tenant ) : EDR Policy already exists. Skipping"
216222 } else {
You can’t perform that action at this time.
0 commit comments