title: Expanding MemberOf
body: <p>Currently working on a PowerShell script for a data vault / security auditing system.</p>
  
  <p>I am currently having some difficulty with the below script</p>
  
  <pre><code>$table_user = @()
  $record_user = [ordered]@{
      "ObjectGUID"         = ""
      "SamAccountName"     = ""
      "Name"               = ""
      "Surname"            = ""
      "GivenName"          = ""
      "Created"            = ""
      "Modified"           = ""
      "LastLogon"          = ""
      "Enabled"            = ""
      "Office"             = ""
      "Company"            = ""
      "Department"         = ""
      "MemberOf"           = ""
      "HomeDirectory"      = ""
  }
  $Users = Get-AdUser -Filter * -Properties * |
           select ObjectGUID, SamAccountName, Name, Surname, GivenName,
                  @{Name='Created';Expression={$_.Created.ToString("yyyy\/MM\/dd HH:mm:ss")}},
                  @{Name='Modified';Expression={$_.Modified.ToString("yyyy\/MM\/dd HH:mm:ss")}},
                  @{Name="LastLogon";Expression={[DateTime]::FromFileTime($_.lastLogonTimestamp).ToString('yyyy\/MM\/dd HH:mm:ss')}},
                  Enabled, Office, Company, Department, MemberOf, HomeDirectory
  
  foreach ($user in $users) {
      $Record_User."ObjectGUID"     = $User.ObjectGUID
      $Record_User."SamAccountName" = $User.SamAccountName
      $Record_User."Name"           = $User.Name
      $Record_User."Surname"        = $User.Surname
      $Record_User."GivenName"      = $User.GivenName
      $Record_User."Created"        = $User.Created
      $Record_User."Modified"       = $User.Modified
      $Record_User."LastLogon"      = $User.LastLogon
      $Record_User."Enabled"        = $User.Enabled
      $Record_User."Office"         = $User.Office
      $Record_User."Company"        = $User.Company
      $Record_User."Department"     = $User.Department
      $Record_User."MemberOf"       = $User.MemberOf
      $Record_User."HomeDirectory"  = $User.HomeDirectory
  
      $objRecord = New-Object PSObject -Property $Record_User
      $table_User += $objRecord
  }
  </code></pre>
  
  <p>I am hoping to have each row contain a unique <code>MemberOf</code>, e.g.;</p>
  
  <p><a href="https://i.stack.imgur.com/3tAXI.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/3tAXI.png" alt="EXAMPLE OUTPUT"></a></p>
  
  <p>Would anyone be able to assist me with how to separate the <code>MemberOf</code> groups so each unique group is on a separate line when exported?</p>