title: powershell - list local users and their groups
body: <p>I'd like to have a report with all the local users and their relative groups (users, power users, administrators and so on.</p>
  
  <p>I get the users in this way:</p>
  
  <pre><code>$adsi = [ADSI]"WinNT://."
  $adsi.psbase.children | where {$_.psbase.schemaClassName -match "user"} | select @{n="Name";e={$_.name}}
  </code></pre>
  
  <p>but I don't know how to retrieve their groups. Thanks in advance.  </p>