Today I will go a bit further and find the nested members from the Active Directory.
The following scripts query a localgroup on the localhost or a remote computer, and gather all the local and domain members (direct and nested).
By Default, if you do not specify any parameter, the function will query the Localhost and the Localgroup "Administrators".
Dot SourcingOnce your Powershell is launched you can load the function using the Dot Sourcing method:
Get-LocalGroupAllMembers -ComputerName SERVER01 -GroupName "Administrators"