You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Settings Catalog resources that call Get-IntuneSettingCatalogPolicySetting don't work correctly, this problem was introduced on PR #4962 and occurs when trying to create a new resource at the 1st attempt, the next attempt for some reason then works. This can be reproduced every time by just removing the existing policy and trying to recreate it.
@FabienTschanz First the foreach on Get-IntuneSettingCatalogPolicySettingDSCValue seems to loop several times over the same keys so somehow $global:excludedDscParams is not being updated correctly or at least not in all places it should be, then on the first loop all properties seem to work but on subsequent loops (which probably shouldn't run since it looks like they were processed) it always fails on last property UseAdvancedProtectionAgainstRansomware (using the attached blueprint). The problem occurs following this path:
This then goes back to Get-IntuneSettingCatalogPolicySettingInstanceValue and fails on $SettingValueType = $valuesResult.SettingDefinition.AdditionalProperties.valueDefinition.'@odata.type'.Replace('Definition', '') because the returned value of $valuesResults is $null.
You cannot call a method on a null-valued expression.
+ CategoryInfo : InvalidOperation: (:) [], CimException
FullyQualifiedErrorId : InvokeMethodOnNull
PSComputerName : localhost
@ricmestre Found it, a simple null check was missing... Lucky for me I thought to abstract that stuff quite a bit, so that it's easy to fix. I guess I always tested it by accident with a value on these properties.
Description of the issue
Settings Catalog resources that call Get-IntuneSettingCatalogPolicySetting don't work correctly, this problem was introduced on PR #4962 and occurs when trying to create a new resource at the 1st attempt, the next attempt for some reason then works. This can be reproduced every time by just removing the existing policy and trying to recreate it.
@FabienTschanz First the foreach on Get-IntuneSettingCatalogPolicySettingDSCValue seems to loop several times over the same keys so somehow $global:excludedDscParams is not being updated correctly or at least not in all places it should be, then on the first loop all properties seem to work but on subsequent loops (which probably shouldn't run since it looks like they were processed) it always fails on last property UseAdvancedProtectionAgainstRansomware (using the attached blueprint). The problem occurs following this path:
This then goes back to Get-IntuneSettingCatalogPolicySettingInstanceValue and fails on $SettingValueType = $valuesResult.SettingDefinition.AdditionalProperties.valueDefinition.'@odata.type'.Replace('Definition', '') because the returned value of $valuesResults is $null.
Could you please have a look into this?
Microsoft 365 DSC Version
1.24.828.1
Which workloads are affected
Intune
The DSC configuration
Verbose logs showing the problem
Environment Information + PowerShell Version
Win11 / PS5
The text was updated successfully, but these errors were encountered: