M365Documentation icon indicating copy to clipboard operation
M365Documentation copied to clipboard

Possible exclude and include parameters

Open ASMailer opened this issue 1 year ago • 4 comments

Hi,

what are the possible include/exclude parameter to define the scope needed documentation? The environment is to large to get all information in one step.

Greetings Andi

ASMailer avatar Oct 25 '24 19:10 ASMailer

Hi,

what are the possible include/exclude parameter to define the scope needed documentation? The environment is to large to get all information in one step.

Greetings Andi

Are you're referring to the -IncludeSections / -ExcludeSections parameter as shown below in the documentation? # Collect information for component Intune as an example $doc = Get-M365Doc -Components Intune -ExcludeSections "MobileAppDetailed"

I was looking for the possible values for these parameters (because our environment is also way too big), and finally found them here: https://github.com/ThomasKur/M365Documentation/tree/main/PSModule/M365Documentation/Internal/Collector For each -Component there are collector functions defined there which correspond to the -IncludeSections and -ExcludeSections parameters.

The example in the documentation corresponds to the collector function located in the Intune folder named "Get-MobileAppDetailed" $doc = Get-M365Doc -Components Intune -ExcludeSections "MobileAppDetailed" https://github.com/ThomasKur/M365Documentation/blob/main/PSModule/M365Documentation/Internal/Collector/Intune/Get-MobileAppDetailed.ps1

So to retrieve the available Sections names: for each collector function in https://github.com/ThomasKur/M365Documentation/tree/main/PSModule/M365Documentation/Internal/Collector just strip "Get-" and ".ps1" from the name of the function.

snodecoder avatar Oct 29 '24 22:10 snodecoder

Thank you for the hint. That helps a lot and makes things clear. I have now seen with the Verbose switch that the reason it doesn't finish is that it retrieves the members from the assignments, already include only one topic.

image

Do you know if it is somehow possible to suppress the retrieval of the group members?

Greetings, Andi

ASMailer avatar Oct 30 '24 10:10 ASMailer

Not to my knowledge. You would need to edit and execute the internal collector functions in the PS module separately to accomplish that. If you take a look at row 34 in https://github.com/ThomasKur/M365Documentation/blob/main/PSModule/M365Documentation/Internal/Collector/Intune/Get-MdmConfigurationProfile.ps1, you can see that the Get-AssignmentDetail is hardcoded in the function, so you would need to take it out.

snodecoder avatar Oct 30 '24 16:10 snodecoder

Yes, there is no option at the moment. But what is the problem? Are the groups empty or are there old orphan groups referenced?

ThomasKur avatar Nov 01 '24 22:11 ThomasKur

The problem is the length of the runtime, at some point the token expires and no further member information can be retrieved.

There is simply too much member information and it is not worth retrieving it for documentation purposes. We have a total of 120K devices and a corresponding number of devices/users which are included in the groups.

It would be sufficient for us if only the policy configuration was extracted without details about the assignments (members).

ASMailer avatar Nov 02 '24 22:11 ASMailer

ok, I see and will think about how I can integrate it. I'm already working on a version where the token can be renewed during runtime.

ThomasKur avatar Nov 03 '24 07:11 ThomasKur

It would be a great if you make a parameter available in the Get-M365Doc, to control this line here ... in the helper function "Get-AssignmentDetailSingle.ps1" ... image

So it would report still the group names, in the Doc, and instead of the "Member Count" value something like "Member details suppressed"

At the moment I will help myself to comment out the line until another solution is available.

Thanks in advance

ASMailer avatar Nov 04 '24 16:11 ASMailer

Another option would be to be able to parameterize between transistive and direct member count. The direct member count can be obtained via ...

GET https://graph.microsoft.com/v1.0/groups/02bd9fd6-8f93-4758-87c3-1fb73740a315/members/$count Header: ConsistencyLevel: eventual

ASMailer avatar Nov 05 '24 10:11 ASMailer

The workaround has been effective for us.

Just for information, we noticed an another issue when generating the ConfigurationProfile documentation, which resulted in a 50 MB document spanning 21,000 pages. This was due to properties such as Payload, Description, WallpaperImage, trustedRootCertificate, configurationXML, and startMenuLayoutEdgeAssetXml, ... "Payload" was the primary issue.

To address this, we modified the "Get-MdmConfigurationProfile" function by truncating all strings longer than 100 characters and removing the image properties. These changes successfully reduced the file size to 1 MB, making the Word document manageable again.

ASMailer avatar Nov 06 '24 14:11 ASMailer

Hi, what are the possible include/exclude parameter to define the scope needed documentation? The environment is to large to get all information in one step. Greetings Andi

Are you're referring to the -IncludeSections / -ExcludeSections parameter as shown below in the documentation? # Collect information for component Intune as an example $doc = Get-M365Doc -Components Intune -ExcludeSections "MobileAppDetailed"

I was looking for the possible values for these parameters (because our environment is also way too big), and finally found them here: https://github.com/ThomasKur/M365Documentation/tree/main/PSModule/M365Documentation/Internal/Collector For each -Component there are collector functions defined there which correspond to the -IncludeSections and -ExcludeSections parameters.

The example in the documentation corresponds to the collector function located in the Intune folder named "Get-MobileAppDetailed" $doc = Get-M365Doc -Components Intune -ExcludeSections "MobileAppDetailed" https://github.com/ThomasKur/M365Documentation/blob/main/PSModule/M365Documentation/Internal/Collector/Intune/Get-MobileAppDetailed.ps1

So to retrieve the available Sections names: for each collector function in https://github.com/ThomasKur/M365Documentation/tree/main/PSModule/M365Documentation/Internal/Collector just strip "Get-" and ".ps1" from the name of the function.

@snodecoder , If i want to get only the autopilot information, what code would i write here? I have tried

$doc = Get-M365Doc -Components Intune -Includeections "Autopilot Configuration", but it errors out.

darkkid85 avatar Mar 25 '25 16:03 darkkid85

If my reasoning above is correct, for only autopilot info you would need "MdmAutopilotProfile"

snodecoder avatar Mar 25 '25 17:03 snodecoder

So to retrieve the available Sections names: for each collector function in https://github.com/ThomasKur/M365Documentation/tree/main/PSModule/M365Documentation/Internal/Collector just strip "Get-" and ".ps1" from the name of the function.

Apologies, can u share the query with an example? Let us say, i want to retrieve only the Autopilot profiles and nothing else (as our environment is way 2 large)

Is the syntax something like $doc = Get-M365Doc -Components Intune -IncludeSections "Autopilot Configuration",?

darkkid85 avatar Mar 25 '25 17:03 darkkid85

My guess is that it would be: $doc = Get-M365Doc -Components Intune -IncludeSections "MdmAutopilotProfile"

snodecoder avatar Mar 25 '25 17:03 snodecoder

Just released an updated version which simplifies the selection process by providing an UI to choose the Sections and mitigate problems:

$Selection = Get-M365DocValidSection | Out-GridView -OutputMode Multiple
$Sections = $Selection | Select-Object -ExpandProperty SectionName
$Components = $Selection | Select-Object -ExpandProperty Component -Unique
$doc = Get-M365Doc -Components $Components -IncludeSections $Sections

You can also just get a list of options by executing: Get-M365DocValidSection

ThomasKur avatar Mar 28 '25 04:03 ThomasKur