Skip to content

Commit 5bea986

Browse files
committed
Compliance Policy Fix
1 parent 967a19f commit 5bea986

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,10 @@ function Set-CIPPIntunePolicy {
3535
$JSON = $RawJSON | ConvertFrom-Json | Select-Object * -ExcludeProperty id, createdDateTime, lastModifiedDateTime, version, 'scheduledActionsForRule@odata.context', '@odata.context'
3636
$JSON.scheduledActionsForRule = @($JSON.scheduledActionsForRule | Select-Object * -ExcludeProperty 'scheduledActionConfigurations@odata.context')
3737
if ($displayname -in $CheckExististing.displayName) {
38-
$RawJSON = ConvertTo-Json -InputObject $JSON -Depth 20 -Compress
38+
$RawJSON = ConvertTo-Json -InputObject ($JSON | Select-Object * -ExcludeProperty 'scheduledActionsForRule') -Depth 20 -Compress
3939
$PostType = 'edited'
4040
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname
41-
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PUT -body $RawJSON
41+
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON
4242
Write-LogMessage -user $request.headers.'x-ms-client-principal' -API $APINAME -tenant $($tenantFilter) -message "Updated policy $($DisplayName) to template defaults" -Sev 'info'
4343
$CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName
4444
} else {

0 commit comments

Comments
 (0)