PowerShell
                                
                                 PowerShell copied to clipboard
                                
                                    PowerShell copied to clipboard
                            
                            
                            
                        Improve to allow on Prem Mail boxes on Get-DistributionGroupMemberRecursive
You could add in your SWITCH ($Member.RecipientType)...
{($_ -eq "UserMailbox") -or ($_ -eq "Mailuser")} {
To include both cases of Onprem Mailboxes (Mailuser) vs O365 Mailboxes (UserMailbox)
Also you could add a default case for new cases that are not being handled.