Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting System.Management.Automation.MethodInvocationException when running Export-M365DSCConfiguration #3352

Closed
meklulose opened this issue May 31, 2023 · 14 comments
Labels
Bug Something isn't working Intune Pending Information V1.23.517.1 Version 1.23.517.1

Comments

@meklulose
Copy link

ISSUE DESCRIPTION:

I am getting the following error:

{NotSpecified}
System.Management.Automation.MethodInvocationException: Exception calling "IndexOf" with "2" argument(s): "Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex" ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: startIndex
   at System.String.IndexOf(String value, Int32 startIndex, Int32 count, StringComparison comparisonType)
   at CallSite.Target(Closure , CallSite , String , String , Object )
   --- End of inner exception stack trace ---
   at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
   at Convert-DSCStringParamToVariable(Closure , FunctionContext )
   at System.Management.Automation.PSScriptCmdlet.RunClause(Action`1 clause, Object dollarUnderbar, Object inputToProcess)
   at System.Management.Automation.PSScriptCmdlet.DoEndProcessing()
   at System.Management.Automation.CommandProcessorBase.Complete()
"Error during Export:"
at Convert-DSCStringParamToVariable, C:\Program Files\WindowsPowerShell\Modules\ReverseDSC\2.0.0.14\ReverseDSC.Core.psm1: line 766
at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.517.1\DSCResources\MSFT_IntuneSettingCatalogCustomPolicyWindows10\MSFT_IntuneSettingCatalogCustomPolicyWindows10.psm1: line 687
at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.517.1\modules\M365DSCReverse.psm1: line 619
at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.517.1\modules\M365DSCUtil.psm1: line 1308
at <ScriptBlock>, C:\Users\getIntuneClientSecret.ps1: line 10

I am running the following command:
Export-M365DSCConfiguration -Components @("IntuneSettingCatalogCustomPolicyWindows10") -ApplicationId $ApplicationId -ApplicationSecret $ApplicationSecret -TenantId $TenantId

I am able to get rest of the configuration for Intune out. I just have issue with this one. I am running this on windows PowerShell ISE. Microsoft365DSC version 1.23.517.1

@andikrueger
Copy link
Collaborator

Could you run a test in a plain powershell session? The error description looks like an issue with an Intune resource.

@andikrueger
Copy link
Collaborator

@William-Francillette could you have a look at this within #3309

@William-Francillette
Copy link
Contributor

@meklulose , could you share more information about the policy you are trying to export please?

The IntuneSettingCatalogCustomPolicyWindows10 is very generic and to troubleshoot the issue I would need to know which setting is configured in your policy

@meklulose
Copy link
Author

@William-Francillette I get the the same error when running in plain PowerShell session. It always fails when trying to extract "Microsoft Edge (EDM) Configuration Profile"

@William-Francillette
Copy link
Contributor

Can you send the exact settings configured in your policy please?
They are a few different setting types and would like to reproduce the error on my side
image

@meklulose
Copy link
Author

meklulose commented Jun 2, 2023

@William-Francillette Please see the following screenshot
image

@William-Francillette
Copy link
Contributor

Thanks, that's perfect - I'll have a look at it tonight

@William-Francillette
Copy link
Contributor

@meklulose, I was able to export the resource, compile it, test it without drift and update it, using those settings in the screenshot - I've added the export below

Could you share more trace of the error please as the issue could be external to the resource itself

Thanks

        IntuneSettingCatalogCustomPolicyWindows10 "IntuneSettingCatalogCustomPolicyWindows10-4e300eed-1d37-493e-a680-12988874587f"
        {
            ApplicationId         = $ConfigurationData.NonNodeData.ApplicationId;
            Assignments           = @(
                MSFT_DeviceManagementConfigurationPolicyAssignments{
                    deviceAndAppManagementAssignmentFilterType = 'none'
                    dataType = '#microsoft.graph.allDevicesAssignmentTarget'
                }
            );
            CertificateThumbprint = $ConfigurationData.NonNodeData.CertificateThumbprint;
            Description           = "";
            Ensure                = "Present";
            Id                    = "4e300eed-1d37-493e-a680-12988874587f";
            Name                  = "Setting Catalog Raw";
            Platforms             = "windows10";
            Settings              = @(
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_abovelock_allowcortanaabovelock_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_abovelock_allowcortanaabovelock'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        SettingDefinitionId = 'device_vendor_msft_policy_config_applicationdefaults_defaultassociationsconfiguration'
                        simpleSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationSimpleSettingValue{
                            odataType = '#microsoft.graph.deviceManagementConfigurationStringSettingValue'
                            StringValue = ''
                        }
                        odataType = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_applicationdefaults_enableappurihandlers_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_applicationdefaults_enableappurihandlers'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_defender_allowarchivescanning_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_defender_allowarchivescanning'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_defender_allowbehaviormonitoring_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_defender_allowbehaviormonitoring'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_defender_allowcloudprotection_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_defender_allowcloudprotection'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Children = @(
                                MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                                    SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_managedfavorites_managedfavorites'
                                    simpleSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationSimpleSettingValue{
                                        odataType = '#microsoft.graph.deviceManagementConfigurationStringSettingValue'
                                        StringValue = 'test'
                                    }
                                    odataType = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance'
                                }
                            )
                            Value = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_managedfavorites_1'
                        }
                        SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_managedfavorites'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Children = @(
                                MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                                    choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                                        Value = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_internetexplorerintegrationlevel_internetexplorerintegrationlevel_1'
                                    }
                                    SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_internetexplorerintegrationlevel_internetexplorerintegrationlevel'
                                    odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                                }
                            )
                            Value = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_internetexplorerintegrationlevel_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_internetexplorerintegrationlevel'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_backgroundmodeenabled_0'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_backgroundmodeenabled'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_backgroundmodeenabled_0'
                        }
                        SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_backgroundmodeenabled'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Children = @(
                                MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                                    SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge~extensions_extensioninstallallowlist_extensioninstallallowlistdesc'
                                    simpleSettingCollectionValue = @(
                                        MSFT_MicrosoftGraphDeviceManagementConfigurationSimpleSettingValue{
                                            odataType = '#microsoft.graph.deviceManagementConfigurationStringSettingValue'
                                            StringValue = '*'
                                        }
                                    )
                                    odataType = '#microsoft.graph.deviceManagementConfigurationSimpleSettingCollectionInstance'
                                }
                            )
                            Value = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge~extensions_extensioninstallallowlist_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge~extensions_extensioninstallallowlist'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Children = @(
                                MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                                    SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge~extensions_extensioninstallblocklist_extensioninstallblocklistdesc'
                                    simpleSettingCollectionValue = @(
                                        MSFT_MicrosoftGraphDeviceManagementConfigurationSimpleSettingValue{
                                            odataType = '#microsoft.graph.deviceManagementConfigurationStringSettingValue'
                                            StringValue = '123456789456'
                                        }
                                    )
                                    odataType = '#microsoft.graph.deviceManagementConfigurationSimpleSettingCollectionInstance'
                                }
                            )
                            Value = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge~extensions_extensioninstallblocklist_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge~extensions_extensioninstallblocklist'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_microsoft_edgev80diff~policy~microsoft_edge_hidefirstrunexperience_1'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edgev80diff~policy~microsoft_edge_hidefirstrunexperience'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_microsoft_edgev99~policy~microsoft_edge_hubssidebarenabled_0'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edgev99~policy~microsoft_edge_hubssidebarenabled'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'device_vendor_msft_policy_config_microsoft_edgev88~policy~microsoft_edge_recommended~performance_recommended_startupboostenabled_recommended_0'
                        }
                        SettingDefinitionId = 'device_vendor_msft_policy_config_microsoft_edgev88~policy~microsoft_edge_recommended~performance_recommended_startupboostenabled_recommended'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Value = 'user_vendor_msft_policy_config_microsoft_edgev88~policy~microsoft_edge_recommended~performance_recommended_startupboostenabled_recommended_0'
                        }
                        SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edgev88~policy~microsoft_edge_recommended~performance_recommended_startupboostenabled_recommended'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Children = @(
                                MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                                    choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                                        Value = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_recommended~startup_recommended_restoreonstartup_recommended_restoreonstartup_1'
                                    }
                                    SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_recommended~startup_recommended_restoreonstartup_recommended_restoreonstartup'
                                    odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                                }
                            )
                            Value = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_recommended~startup_recommended_restoreonstartup_recommended_1'
                        }
                        SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_recommended~startup_recommended_restoreonstartup_recommended'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Children = @(
                                MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                                    SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_recommended~startup_recommended_homepagelocation_recommended_homepagelocation'
                                    simpleSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationSimpleSettingValue{
                                        odataType = '#microsoft.graph.deviceManagementConfigurationStringSettingValue'
                                        StringValue = 'test.com'
                                    }
                                    odataType = '#microsoft.graph.deviceManagementConfigurationSimpleSettingInstance'
                                }
                            )
                            Value = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_recommended~startup_recommended_homepagelocation_recommended_1'
                        }
                        SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edge~policy~microsoft_edge_recommended~startup_recommended_homepagelocation_recommended'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
                MSFT_MicrosoftGraphdeviceManagementConfigurationSetting{
                    SettingInstance = MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                        choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                            Children = @(
                                MSFT_MicrosoftGraphDeviceManagementConfigurationSettingInstance{
                                    choiceSettingValue = MSFT_MicrosoftGraphDeviceManagementConfigurationChoiceSettingValue{
                                        Value = 'user_vendor_msft_policy_config_microsoft_edgev79diff~policy~microsoft_edge_recommended~startup_recommended_newtabpagesetfeedtype_recommended_newtabpagesetfeedtype_0'
                                    }
                                    SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edgev79diff~policy~microsoft_edge_recommended~startup_recommended_newtabpagesetfeedtype_recommended_newtabpagesetfeedtype'
                                    odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                                }
                            )
                            Value = 'user_vendor_msft_policy_config_microsoft_edgev79diff~policy~microsoft_edge_recommended~startup_recommended_newtabpagesetfeedtype_recommended_1'
                        }
                        SettingDefinitionId = 'user_vendor_msft_policy_config_microsoft_edgev79diff~policy~microsoft_edge_recommended~startup_recommended_newtabpagesetfeedtype_recommended'
                        odataType = '#microsoft.graph.deviceManagementConfigurationChoiceSettingInstance'
                    }
                }
            );
            Technologies          = "mdm";
            TenantId              = $OrganizationName;
        }

@William-Francillette
Copy link
Contributor

William-Francillette commented Jun 5, 2023

I tried using certificate thumbprint and client secret, both authentications worked

Can you ensure your service principal has at least
"DeviceManagementConfiguration.Read.All"
and if update needed "DeviceManagementConfiguration.ReadWrite.All"

@meklulose
Copy link
Author

@William-Francillette How would I get more detailed tracing? My event viewer also shows the same error message
[-](https://github.com/microsoft/Microsoft365DSC/issues/3352#) <Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event"> [-](https://github.com/microsoft/Microsoft365DSC/issues/3352#) <System> <Provider Name="MSFT_IntuneSettingCatalogCustomPolicyWindows10" /> <EventID Qualifiers="0">1</EventID> <Version>0</Version> <Level>2</Level> <Task>1</Task> <Opcode>0</Opcode> <Keywords>0x80000000000000</Keywords> <TimeCreated SystemTime="2023-06-06T19:46:52.9657149Z" /> <EventRecordID>4554</EventRecordID> <Correlation /> <Execution ProcessID="0" ThreadID="0" /> <Channel>M365DSC</Channel> <Computer>PS25477.propertyservices.nhs.uk</Computer> <Security /> </System> [-](https://github.com/microsoft/Microsoft365DSC/issues/3352#) <EventData> <Data>Error during Export: { Exception calling "IndexOf" with "2" argument(s): "Index was out of range. Must be non-negative and less than the size of the collection. \ Parameter name: startIndex" } \ at Convert-DSCStringParamToVariable, C:\Program Files\WindowsPowerShell\Modules\ReverseDSC\2.0.0.14\ReverseDSC.Core.psm1: line 766 \ at Export-TargetResource, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.517.1\DSCResources\MSFT_IntuneSettingCatalogCustomPolicyWindows10\MSFT_IntuneSettingCatalogCustomPolicyWindows10.psm1: line 687 \ at Start-M365DSCConfigurationExtract, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.517.1\modules\M365DSCReverse.psm1: line 619 \ at Export-M365DSCConfiguration, C:\Program Files\WindowsPowerShell\Modules\Microsoft365DSC\1.23.517.1\modules\M365DSCUtil.psm1: line 1308 \ at <ScriptBlock>, <No file>: line 8</Data> </EventData> </Event>

The problem might be the policy named "Microsoft Edge Configuration Profile" is there a way I can run the script but exclude it from trying to extract this policy? Thanks for your help!

@William-Francillette
Copy link
Contributor

The display name is not a key word so it should be fine

The code below should allow you to display Get-TargetResource output - Could you modify any variable value such as <variable> and send us the output please:

$params = @{
    Id                          = "<myPolicyId>"
    ApplicationId               = "<myAppId>"
    TenantId                    = "<myDomain>"
    ApplicationSecret           = "<MySecret>"
}
$ResourcePath = "<PathToDSCModule>\Modules\Microsoft365DSC\DSCResources"
$ResourceName = 'IntuneSettingCatalogCustomPolicyWindows10'
$ConnectionMode = New-M365DSCConnection -Workload 'MicrosoftGraph' `
                    -InboundParameters $params `
                    -ProfileName 'beta'

import-module "$ResourcePath\MSFT_$ResourceName" -force
$results=Get-TargetResource @params
$results|convertto-json -depth 100

Could you make sure to hide any confidential information please except for special character that may cause the export to fail such as quotes for example
I'm guessing that one of the textbox values in your screenshot is the culprit

@andikrueger
Copy link
Collaborator

@meklulose any chance you could share additional information?

Is this still an issue with the current version of M365DSC?

@andikrueger andikrueger added the V1.23.517.1 Version 1.23.517.1 label Jul 8, 2023
@NikCharlebois
Copy link
Collaborator

Closing due to inactivity

@ghost
Copy link

ghost commented Nov 24, 2023

I am getting this issue again using version '1.23.1115.1'.

Similar policy settings (Edge Browser), did we ever find out what the issue was?

Thanks in advance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Intune Pending Information V1.23.517.1 Version 1.23.517.1
Projects
None yet
Development

No branches or pull requests

4 participants