Group Object multiple paramter Split

Hi Team,

I am grouping the output in 2 parameter, however the output is mixed up. can this be split for “Name” based on property

$count=$members |Group-Object -Property objectclass,OU_DN | Select-Object Count, Name
$count | export-csv c:\temp\oumembersCount.csv -NoTypeInformation

output ex:

Count Name


2409 computer, OU=Test,DC=TEST3, DC=COM
6027 OU=Test,DC=TEST3, DC=COM
1776 group, OU=Test2,DC=TEST3, DC=COM
2557 user, OU=Test2,DC=TEST3, DC=COM
3411 computer,OU=Test2,DC=TEST3, DC=COM

 

I want the output as

Count Name OU_DN


2409 computer OU=Test,DC=TEST3, DC=COM
1776 group OU=Test2,DC=TEST3, DC=COM
2557 user OU=Test2,DC=TEST3, DC=COM
3411 computer OU=Test2,DC=TEST3, DC=COM

 

$count = 
$members | Group-Object -Property objectclass,OU_DN | 
Select-Object Count, @{n='Name';exp={$_.Name.split(',',2)[0]}},
@{n='OU_DN';exp={$_.Name.split(',',2)[1].Trim()}}

$count | export-csv c:\temp\oumembersCount.csv -NoTypeInformation

Thanks a lot, that did it. Learning new thing everyday and you guys makes it soo easy.