none
get-distributiongroup - Managedby Output need further fomatiing - help. RRS feed

  • Question

  • Hi There,

    Can someone help with this:

    When I ran the PS>

    get-distributiongroup -resultsize unlimited |? {!(get-distributiongroupmember $_)} | Select DisplayName, OriginatingServer, WhenCreated, Managedby | export-csv "c:\myscripts\working\EmptyExchDistGroup.csv"

    This was the output that I got:

    DisplayName             ManagedBy                                                                                                             WhenCreated
    GroupName           mydomain.com/UserAccounts/mydomain User Accounts/Lastname Firstname             25/08/2010 18:34

    however, this is the output that I desire to get:

    DisplayName         ManagedBy                                              WhenCreated
    GroupName            Lastname Firstname                                   25/08/2010

    What do I need to add to my script above to achieve this.

    Please help.

    Thanks.

    TFK


    T I Ajagbe
    Wednesday, February 1, 2012 10:14 AM

Answers

  • Try this:

    get-distributiongroup -resultsize unlimited |? {!(get-distributiongroupmember $_)} | Select DisplayName, OriginatingServer, WhenCreated, @{l="ManagedBy";e={$_.Managedby | Select -Expand Name}} | export-csv "c:\myscripts\working\EmptyExchDistGroup.csv"

    Karl


    My Blog: http://unlockpowershell.wordpress.com
    My Book: Windows PowerShell 2.0 Bible
    My E-mail: -join ("6B61726C6D69747363686B65406D742E6E6574"-split"(?<=\G.{2})",19|%{[char][int]"0x$_"})
    • Marked as answer by taofikng Wednesday, February 1, 2012 5:34 PM
    Wednesday, February 1, 2012 3:31 PM

All replies