Powershell Get-ADgroup show member names inline -


i've got script lists groups details. amongst others members. default members shown dn's. how can show names (eg jon doe, jane doe, ...).

currently code goes follows:

$groups = get-adgroup -filter * -searchbase $searchbase -properties $groupcolumns | where-object {$_.groupcategory -eq "distribution"} | sort-object name | select-object $grouptableheader 

this returns groups columns want. members-column content shown cn=john doe,ou=users,dc=company,dc=com cn=jane doe,ou=users,dc=company,dc=com

thanks in advance help

you issue get-adobject each member , name expensive operation. can use regular expression extract names:

$_.member -replace '^cn=([^,]+).+$','$1' 

the above captures after 'cn=' until first comma, , replaces whole string match.


Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -