Skip to content

Commit 9090d49

Browse files
corrected duplicate policy deployment for devices
1 parent 089684d commit 9090d49

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

Modules/CIPPCore/Public/Set-CIPPIntunePolicy.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ function Set-CIPPIntunePolicy {
7676
$null = $PolicyFile | Add-Member -MemberType NoteProperty -Name 'displayName' -Value $displayname -Force
7777
$RawJSON = ConvertTo-Json -InputObject $PolicyFile -Depth 20
7878
$CheckExististing = New-GraphGETRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL" -tenantid $tenantFilter
79-
if ($PolicyName -in $PolicyFile.displayName) {
79+
if ($PolicyFile.displayName -in $CheckExististing.displayName) {
8080
$PostType = 'edited'
8181
$ExistingID = $CheckExististing | Where-Object -Property displayName -EQ $PolicyName
8282
$CreateRequest = New-GraphPOSTRequest -uri "https://graph.microsoft.com/beta/deviceManagement/$TemplateTypeURL/$($ExistingID.Id)" -tenantid $tenantFilter -type PATCH -body $RawJSON

0 commit comments

Comments
 (0)