@@ -32,37 +32,36 @@ function Get-CIPPDrift {
3232 $IntuneCapable = Test-CIPPStandardLicense - StandardName ' IntuneTemplate_general' - TenantFilter $TenantFilter - RequiredCapabilities @ (' INTUNE_A' , ' MDM_Services' , ' EMS' , ' SCCM' , ' MICROSOFTINTUNEPLAN1' )
3333 $ConditionalAccessCapable = Test-CIPPStandardLicense - StandardName ' ConditionalAccessTemplate_general' - TenantFilter $TenantFilter - RequiredCapabilities @ (' AAD_PREMIUM' , ' AAD_PREMIUM_P2' )
3434 $IntuneTable = Get-CippTable - tablename ' templates'
35- if ($IntuneCapable ) {
36- $IntuneFilter = " PartitionKey eq 'IntuneTemplate'"
37- $RawIntuneTemplates = (Get-CIPPAzDataTableEntity @IntuneTable - Filter $IntuneFilter )
38- $AllIntuneTemplates = $RawIntuneTemplates | ForEach-Object {
39- try {
40- $JSONData = $_.JSON | ConvertFrom-Json - Depth 10 - ErrorAction SilentlyContinue
41- $data = $JSONData.RAWJson | ConvertFrom-Json - Depth 10 - ErrorAction SilentlyContinue
42- $data | Add-Member - NotePropertyName ' displayName' - NotePropertyValue $JSONData.Displayname - Force
43- $data | Add-Member - NotePropertyName ' description' - NotePropertyValue $JSONData.Description - Force
44- $data | Add-Member - NotePropertyName ' Type' - NotePropertyValue $JSONData.Type - Force
45- $data | Add-Member - NotePropertyName ' GUID' - NotePropertyValue $_.RowKey - Force
46- $data
47- } catch {
48- # Skip invalid templates
49- }
50- } | Sort-Object - Property displayName
51- }
35+
36+ # Always load templates for display name resolution, even if tenant doesn't have licenses
37+ $IntuneFilter = " PartitionKey eq 'IntuneTemplate'"
38+ $RawIntuneTemplates = (Get-CIPPAzDataTableEntity @IntuneTable - Filter $IntuneFilter )
39+ $AllIntuneTemplates = $RawIntuneTemplates | ForEach-Object {
40+ try {
41+ $JSONData = $_.JSON | ConvertFrom-Json - Depth 10 - ErrorAction SilentlyContinue
42+ $data = $JSONData.RAWJson | ConvertFrom-Json - Depth 10 - ErrorAction SilentlyContinue
43+ $data | Add-Member - NotePropertyName ' displayName' - NotePropertyValue $JSONData.Displayname - Force
44+ $data | Add-Member - NotePropertyName ' description' - NotePropertyValue $JSONData.Description - Force
45+ $data | Add-Member - NotePropertyName ' Type' - NotePropertyValue $JSONData.Type - Force
46+ $data | Add-Member - NotePropertyName ' GUID' - NotePropertyValue $_.RowKey - Force
47+ $data
48+ } catch {
49+ # Skip invalid templates
50+ }
51+ } | Sort-Object - Property displayName
52+
5253 # Load all CA templates
53- if ($ConditionalAccessCapable ) {
54- $CAFilter = " PartitionKey eq 'CATemplate'"
55- $RawCATemplates = (Get-CIPPAzDataTableEntity @IntuneTable - Filter $CAFilter )
56- $AllCATemplates = $RawCATemplates | ForEach-Object {
57- try {
58- $data = $_.JSON | ConvertFrom-Json - Depth 100 - ErrorAction SilentlyContinue
59- $data | Add-Member - NotePropertyName ' GUID' - NotePropertyValue $_.RowKey - Force
60- $data
61- } catch {
62- # Skip invalid templates
63- }
64- } | Sort-Object - Property displayName
65- }
54+ $CAFilter = " PartitionKey eq 'CATemplate'"
55+ $RawCATemplates = (Get-CIPPAzDataTableEntity @IntuneTable - Filter $CAFilter )
56+ $AllCATemplates = $RawCATemplates | ForEach-Object {
57+ try {
58+ $data = $_.JSON | ConvertFrom-Json - Depth 100 - ErrorAction SilentlyContinue
59+ $data | Add-Member - NotePropertyName ' GUID' - NotePropertyValue $_.RowKey - Force
60+ $data
61+ } catch {
62+ # Skip invalid templates
63+ }
64+ } | Sort-Object - Property displayName
6665
6766 try {
6867 $AlignmentData = Get-CIPPTenantAlignment - TenantFilter $TenantFilter - TemplateId $TemplateId | Where-Object - Property standardType -EQ ' drift'
0 commit comments