Skip to content

Commit

Permalink
Compliance Policy Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
OfficialEsco committed Sep 2, 2024
1 parent d3de417 commit f56c58e
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ function Set-CIPPIntunePolicy {
$JSON = $RawJSON | ConvertFrom-Json | Select-Object * -ExcludeProperty id, createdDateTime, lastModifiedDateTime, version, 'scheduledActionsForRule@odata.context', '@odata.context'
$JSON.scheduledActionsForRule = @($JSON.scheduledActionsForRule | Select-Object * -ExcludeProperty 'scheduledActionConfigurations@odata.context')
if ($displayname -in $CheckExististing.displayName) {
$RawJSON = ConvertTo-Json -InputObject $JSON -Depth 20 -Compress
$RawJSON = ConvertTo-Json -InputObject ($JSON | Select-Object * -ExcludeProperty 'scheduledActionsForRule') -Depth 20 -Compress
$PostType = 'edited'
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PUT -body $RawJSON
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info'
$CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName
} else {
Expand Down

0 comments on commit f56c58e

Please sign in to comment.