Skip to content

Commit ea92699

Browse files
committed
fix: fixes Windows Feature Update and Driver Update config
1 parent 32af0b1 commit ea92699

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,12 @@ function Set-CIPPIntunePolicy {
142142
$CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL" -tenantid $tenantFilter
143143
if ($DisplayName -in $CheckExististing.displayName) {
144144
$PostType = 'edited'
145+
$PolicyFile = $RawJSON | ConvertFrom-Json | Select-Object * -ExcludeProperty inventorySyncStatus, newUpdates, deviceReporting, approvalType
146+
$RawJSON = ConvertTo-Json -InputObject $PolicyFile -Depth 100 -Compress
145147
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname
146148
Write-Host 'We are editing'
147-
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PUT -body $RawJSON
149+
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON
148150
$CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName
149-
150151
} else {
151152
$PostType = 'added'
152153
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL" -tenantid $tenantFilter -type POST -body $RawJSON
@@ -161,9 +162,11 @@ function Set-CIPPIntunePolicy {
161162
$CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL" -tenantid $tenantFilter
162163
if ($DisplayName -in $CheckExististing.displayName) {
163164
$PostType = 'edited'
165+
$PolicyFile = $RawJSON | ConvertFrom-Json | Select-Object * -ExcludeProperty deployableContentDisplayName, endOfSupportDate, installLatestWindows10OnWindows11IneligibleDevice
166+
$RawJSON = ConvertTo-Json -InputObject $PolicyFile -Depth 100 -Compress
164167
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $displayname
165168
Write-Host 'We are editing'
166-
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PUT -body $RawJSON
169+
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/$PlatformType/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON
167170
$CreateRequest = $CheckExististing | Where-Object -Property displayName -EQ $DisplayName
168171

169172
} else {

0 commit comments

Comments
 (0)