Skip to content

Commit ad7cf96

Browse files
changes to drift management for improved performance
1 parent d612dc6 commit ad7cf96

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Modules/CIPPCore/Public/Get-CIPPDrift.ps1

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ function Get-CIPPDrift {
101101
#if the $ComparisonItem.StandardName contains *intuneTemplate*, then it's an Intune policy deviation, and we need to grab the correct displayname from the template table
102102
if ($ComparisonItem.StandardName -like '*intuneTemplate*') {
103103
$CompareGuid = $ComparisonItem.StandardName.Split('.') | Select-Object -Index 2
104-
Write-Host "Extracted GUID: $CompareGuid"
105-
$Template = $AllIntuneTemplates | Where-Object { $_.GUID -like "*$CompareGuid*" }
104+
Write-Verbose "Extracted GUID: $CompareGuid"
105+
$Template = $AllIntuneTemplates | Where-Object { $_.GUID -eq "$CompareGuid" }
106106
if ($Template) {
107107
$displayName = $Template.displayName
108108
$standardDescription = $Template.description
@@ -111,8 +111,8 @@ function Get-CIPPDrift {
111111
# Handle Conditional Access templates
112112
if ($ComparisonItem.StandardName -like '*ConditionalAccessTemplate*') {
113113
$CompareGuid = $ComparisonItem.StandardName.Split('.') | Select-Object -Index 2
114-
Write-Host "Extracted CA GUID: $CompareGuid"
115-
$Template = $AllCATemplates | Where-Object { $_.GUID -like "*$CompareGuid*" }
114+
Write-Verbose "Extracted CA GUID: $CompareGuid"
115+
$Template = $AllCATemplates | Where-Object { $_.GUID -eq "$CompareGuid" }
116116
if ($Template) {
117117
$displayName = $Template.displayName
118118
$standardDescription = $Template.description
@@ -307,7 +307,7 @@ function Get-CIPPDrift {
307307
standardName = $PolicyKey
308308
standardDisplayName = "Conditional Access - $($TenantCAPolicy.displayName)"
309309
expectedValue = 'This policy only exists in the tenant, not in the template.'
310-
receivedValue = $TenantCAPolicy
310+
receivedValue = $TenantCAPolicy | Out-String
311311
state = 'current'
312312
Status = $Status
313313
}

0 commit comments

Comments
 (0)