Extract members from AD groups in a txt file

Extracting members doesnt work if members are from different domains

Are you getting any error ? if not what is the output against the accounts in other domain ?

Thanks for the response. There’s no error. Basically, there are some members (e.g. NA/patrick, SA/Antonio) inside the Global Group AP/Sales_Container.GG. Even though there are also AP members inside the group, the output .csv did not display the results from that group. However, there’s no problem in displaying the results if all the members are in the AP domain

And the underlying trusts for all your domains is proper? Maybe the other Domains dont trust AP, but AP trusts them?

And I trust (pun intended :)) you are aware of $ENV:LogonServer which is the DC you authenticate to? It would be interesting to see what happens if you also change this in your loop to the selected domain.