none
Problem with output formatting RRS feed

  • Question

  • Hi guys,
    I need your help with formatting output from my script.
    The script is retrieving data from AD and showing it in a table. The problem is with users group membership, 
    it's displayed like @{Name="group name"} and I want it to be like "group name".

    My script:
    -------------------------------------------------------
    $ou = "OU=EPC,DC=fr,DC=pri"

    Get-ADUser -SearchBase $ou -Filter * -Properties LockedOut,Modified,DisplayName,Description,SamAccountName | 
    Select-Object -Property SamAccountName,Enabled,
    @{n='Group Membership';e={Get-ADGroup -LDAPFilter "(member:1.2.840.113556.1.4.1941:=$($_.DistinguishedName))" | Select -Property Name}} | ft -AutoSize
    -------------------------------------------------------

    I'm retriving group membership with:
    Get-ADGroup -LDAPFilter "(member:1.2.840.113556.1.4.1941:=$($_.DistinguishedName))" | Select -Property Name}
    ...becaues I also want nested groups.

    This is my output now:

    SamAccountName   Enabled        Group Membership                         
    --------------             -------           ----------------                         
    Read                       True             {@{Name=Catalog-Read}, @{Name=Top-Group}}
    Full                         True             @{Name=Catalog-Full}                     
    User3                     True                                          
    svc-xxx                   True                                          
    svx                         True   

    ...and this is what I want to get:

    SamAccountName     Enabled        Group Membership                         
    --------------               -------           ----------------                         
    Read                         True             Catalog-Read, Top-Group
    Full                           True             Catalog-Full                     
    User3                       True                                          
    svc-xxx                     True                                          
    svx                           True   
    Tuesday, January 27, 2015 10:12 AM

Answers

All replies