Expand property using hash table and PSObject

Is it possible to expand a property in a hash table and pass that to a PSObject?

I’m looking to expand the MemberOf property in an AD Audit report (see bottom example).

get-aduser grant.harrington -Properties * | select @{n='memberof';e={$_.memberof -join '; '}} | ft -Wrap
get-aduser grant.harrington -Properties * | select -ExpandProperty MemberOf
        $GetUser = Get-ADUser -SearchBase $MyOU -filter $varName -Properties * #-Credential $DomainCredential
            foreach ($GU in $GetUser)
                $ObjAccountReviewResults =[ordered]@{
                    "Full Name"=$GU.CN
                    "First Name"=$GU.GivenName
                    "Last Name"=$GU.Surname
                    "Display Name"=$GU.DisplayName
                    "Office Phone"=$GU.OfficePhone
                    "E-Mail Address"=$GU.EmailAddress
                    "REE Web Page"=$GU.wWWHomePage
                    "Login Name"=$GU.UserPrincipalName
                   "Password Never Expires Setting: " =  $GU.PasswordNeverExpires
                    "Home Drive Letter"=$GU.HomeDrive
                    "Home Directory"=$GU.HomeDirectory
                    "Department (RU)"=$GU.Department
                    "Manager (Supervisor)"=$GU.Manager
                    "Member Of"=$GU.MemberOf
                    "Member Of2" =  -ExpandProperty $GU.MemberOf
                    "Member Of3" = "@{n='$GU.memberof';e={$GU.memberof -join '; '}}"
                    "Distinguished Name" = $GU.DistinguishedName
                    "Account enabled (T/F)"=$GU.Enabled
                    "Last Login"=$GU.LastLogonDate
                    "Last Bad Password Attempt"=$GU.LastBadPasswordAttempt
                    "Security ID"=$GU.SID
                    } #end ObjAccountReviewResults

            $ObjAccountReview = New-Object -TypeName PSObject -Property $ObjAccountReviewResults
            Write-Output $ObjAccountReview

try this line

"Member Of" = $GU.MemberOf -join ';'

That was easy. :slight_smile:

Thank you, that produced the results I was looking for.