Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

expanding the member list of a DL

$
0
0

I have this code that will get the members of the DL, however those DL with large member list it doesnt display all the members in the screen. I can use the switch "-expandproperty" but this would mean i have to remove the other columns on my select statement.. FOr this one I used PScustomobj in the hopes of displaying all its members but still its not listing all of its members. ANy suggestions?

Also when you use -ExpandProperty is there another way to list other columns in the select-object?

$data = Get-Content "adgrps.txt"
$server = "server name"
$ad_grp_arr = @()
$mem_arr = @()

foreach ($line in $data){ 
    $ad_grp_arr += Get-ADGroup -Server $server -Identity $line -Properties *
}

foreach ($mem in $ad_grp_arr){
   
    $ht = [PSCustomObject]@{
        DL_Name = $mem.Name
        #Members = $mem.Members -replace '^CN=|,.*$' -join ';'
        Members = $mem.Members -replace '^CN=|,.*$'
    }
    $mem_arr += $ht
}

$mem_arr


PoSH newbie, BaSH Oldie


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>