Exporting Settings Catalog configurations is limited to 25

Pavel yannara Mirochnitchenko 12,411 Reputation points MVP
2023-05-22T05:49:53.6266667+00:00

I need to help from this community, to improve the samples linked below, because the current problem is, that SettingsCatalog_Export.ps1 can only export 25 policies at the time from Settings Catalog. To get desired policies exported, I had basically to delete some policies because at the moment I had more than SCs 25 in my tenant. I did contact the developer, but he did not react on this. Unfortunatelly my powershell skills are not enough for this, and I would like to archive;

Option A: Fix the limitation of 25, so it would really export everything you have
Option B (maybe even more preferred): Make export selectable, so during the export command I would have to type the policy name I want to export. That is how the SettingsCatalog_Import_FromJSON.ps1 works now.

https://github.com/microsoftgraph/powershell-intune-samples/tree/master/SettingsCatalog

Microsoft Intune Configuration
Microsoft Intune Configuration
Microsoft Intune: A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.Configuration: The process of arranging or setting up computer systems, hardware, or software.
1,789 questions
Microsoft Intune
Microsoft Intune
A Microsoft cloud-based management solution that offers mobile device management, mobile application management, and PC management capabilities.
4,693 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,287 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Limitless Technology 44,096 Reputation points
    2023-05-22T12:05:41.3433333+00:00

    Hi,

    I'd be happy to help you out with your question. Sorry for the inconvenience caused.

    Yes, To address your concern, there are two options we can explore:

    Option A: Fix the limitation of 25

    To fix the limitation and enable the export of all policies, you will need to modify the SettingsCatalog_Export.ps1 script. Here's a general approach:

    1. Open the SettingsCatalog_Export.ps1 script in a text editor or PowerShell Integrated Scripting Environment (ISE).
    2. Locate the section of the script responsible for the export process.
    3. Check if there is any code related to pagination or query parameters that limits the number of exported policies.
    4. Modify the script to handle pagination and retrieve all policies without the restriction of 25. This may involve adjusting query parameters or implementing a loop to fetch multiple sets of policies.
    5. Ensure that the exported data is combined and formatted correctly to achieve the desired output.

    Please note that the specific implementation details may vary depending on the script's original design. It is crucial to understand the existing code and the APIs it interacts with to make the necessary modifications.

    Option B: Make export selectable

    To make the export selectable and allow you to specify the policy name during the export command, you will need to modify the SettingsCatalog_Export.ps1 script to accept user input. Here's a general approach:

    1. Open the SettingsCatalog_Export.ps1 script in a text editor or PowerShell ISE.
    2. Identify the section of the script where the policy export process is initiated or where the policy names are retrieved.
    3. Modify the script to prompt the user for the desired policy name to export.
    4. Update the export logic to export only the selected policy instead of exporting all policies.
    5. Implement proper error handling to handle invalid policy names or other potential issues.

    You can use PowerShell's Read-Host cmdlet to prompt the user for input and capture their response.

    Again, please note that the specific implementation details may vary based on the script's structure and logic. Understanding the existing code and its interaction with APIs is crucial for making the necessary modifications.

    If you have any other questions or need assistance with anything, please don't hesitate to let me know. I'm here to help.

    If the reply was helpful, please don’t forget to upvote or accept as answer, thank you.


  2. Rich Matheisen 45,671 Reputation points
    2023-05-22T14:41:34.91+00:00

    Have a look at this: https://techcommunity.microsoft.com/t5/microsoft-intune/get-intunedeviceconfigurationpolicy-returns-only-some-of-my/m-p/2082462

    You can try modifying the function that uses MS Graph REST to make use of the 'beta' endpoint.