GroupMembership

Because we don’t expect more nesting than 2 layers for the groups we are searching for. So at max searching for 3 layers should be sufficient.

Okay, below is the new code to try out. I had to create a whole new function to carry this out for you.

<script src=“https://gist.github.com/JasonRobertson/0de9df37e5dd7f3a5679bbcae9c94daf.js”></script>

Here is an example of it in action

C:\Users\Jason.robertson> Get-NestedGroup -Identity sales | Export-Csv C:\Temp\Example.csv
C:\Users\Jason.robertson> Import-Csv C:\Temp\Example.csv | FL

ParentDG  : Sales
NestedDG1 : team-sales-development-reps
NestedDG2 : No Nested Group

Thanks Jason. Will try it out.