PowerShell Fun: Most common given names in Active Directory

We were just having a discussion here at work about the most common given names in the organisation. I decided to put my PowerShell skills to good use, to give us a definitive list from AD.

Get-ADUser -filter * | Select-Object givenname,surname -Unique | ? {$_.GivenName -ne $null} | Group-Object -Property givenname | Sort-Object -Property count -Descending | Select-Object -property count,name -First 20

Note that I made some adjustments above to not display the grouping data which includes surnames. Piping the above to Out-GridView results in an easy-to-read listing:

image

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s