title: How to get ALL AD user groups (recursively) with Powershell or other tools?
body: <p>I'm trying to get ALL the groups a user is member, even the nested ones (recusively), in Powershell I'm using:</p>
  
  <pre><code>(Get-ADUser &lt;username&gt; -Properties MemberOf | Select-Object MemberOf).MemberOf
  </code></pre>
  
  <p>But it only returns the groups the user is a "direct" member, like you get when using the AD users console. I single list of ALL the groups is very helpful, like the output from "gpresult -r", where it shows ALL the groups the user is a member.</p>
  
  <p>Is there a way to get it from any AD user? (Doesnt need to be exclusively in Powershell, maybe theres another tool that I dont know yet)</p>