Skip to content

Commit 7408b6c

Browse files
fixes reporting issue
1 parent f0e5936 commit 7408b6c

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Modules/CIPPCore/Public/Standards/Invoke-CIPPStandardIntuneTemplate.ps1

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,10 @@ function Invoke-CIPPStandardIntuneTemplate {
7272
Write-Host "IntuneTemplate: $($Template.TemplateList.value) - Compared JSON: $($Compare | ConvertTo-Json -Compress)"
7373
} else {
7474
Write-Host "IntuneTemplate: $($Template.TemplateList.value) - No existing policy found."
75+
$compare = [pscustomobject]@{
76+
MatchFailed = $true
77+
Difference = 'This policy does not exist in Intune.'
78+
}
7579
}
7680
if ($Compare) {
7781
Write-Host "IntuneTemplate: $($Template.TemplateList.value) - Compare found differences."
@@ -112,7 +116,7 @@ function Invoke-CIPPStandardIntuneTemplate {
112116
}
113117
}
114118

115-
If ($true -in $Settings.remediate) {
119+
if ($true -in $Settings.remediate) {
116120
Write-Host 'starting template deploy'
117121
foreach ($TemplateFile in $CompareList | Where-Object -Property remediate -EQ $true) {
118122
Write-Host "working on template deploy: $($TemplateFile.displayname)"
@@ -146,7 +150,7 @@ function Invoke-CIPPStandardIntuneTemplate {
146150
}
147151

148152
if ($true -in $Settings.report) {
149-
foreach ($Template in $CompareList | Where-Object -Property report -EQ $true) {
153+
foreach ($Template in $CompareList | Where-Object { $_.report -eq $true -or $_.remediate -eq $true }) {
150154
Write-Host "working on template report: $($Template.displayname)"
151155
$id = $Template.templateId
152156
$CompareObj = $Template.compare

0 commit comments

Comments
 (0)