This script allows me to display a lst of security groups in an OU
Get-ADGroup -Filter {GroupCategory -eq 'Security'} -searchbase 'My OU Here'
This script allows me to use an input file containing groups to either display a list of groups,# uf members, and names of members or write that information to a file.
You’ll have to decide what you want to include in $props, which becomes part of your output. I’ll warn you that working with object hierarchies can be tricky, and that’s what you’re asking to do. A group is a single entity; each of its members is also an entity. PowerShell doesn’t provide awesome default formatting for entities that have sub-entities, so you’ll need to decide how you want to use that output and do a bit of work to get there.
Just to take the forum software out of the equation, I tried putting the same text into PRE and CODE tags in a local HTML file. Even then, I’m not seeing how CODE is useful (since it stuck everything all on one line, instead of keeping the line breaks and spacing). See attached HTML file (renamed to .txt) and screenshot.