Skip to content

Instantly share code, notes, and snippets.

@janikvonrotz
Created December 17, 2013 12:27
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save janikvonrotz/8004160 to your computer and use it in GitHub Desktop.
Save janikvonrotz/8004160 to your computer and use it in GitHub Desktop.
PowerShell: Get All Cost Centers and Department Names #PowerShell #ActiveDirectory
# extensionattribute2 ist cost center number
Get-ADUser -Filter * -Properties extensionattribute2, department | where{$_.extensionattribute2 -and $_.department} | select extensionattribute2, department -Unique | sort extensionattribute2 | out-gridview
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment