Skip to content

Instantly share code, notes, and snippets.

@JanVidarElven
Created July 15, 2016 10:37
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save JanVidarElven/bb9046e4b944af0d42c47ad94cfc06ca to your computer and use it in GitHub Desktop.
Save JanVidarElven/bb9046e4b944af0d42c47ad94cfc06ca to your computer and use it in GitHub Desktop.
Group On UPN Suffixes used in Active Directory
# Require the Active Directory PowerShell Module, installed with AD RSAT tools
Import-Module ActiveDirectory
# Group count of all UPN suffixes in your Active Directory
Get-ADUser -Filter * | Select UserPrincipalName, @{Name="UPNSuffix"; Expression={($_.UserPrincipalName.Split("@",2)[1])}} | Group UPNSuffix
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment