Gotch
Gotch

Reputation: 79

List of users based on Description in Active Directory using Powershell

I'm basically new to PowerShell. May I ask what do I need to do in Get-ADUser -filter.. to pull out users that have the same description?

Upvotes: 1

Views: 2623

Answers (2)

BenH
BenH

Reputation: 10044

You could use the Group-Object cmdlet to group object together with the same description.

Get-ADUser -Filter * -Properties Description |
    Select-Object Name,Description | 
    Group-Object Description |
    Where-Object {$_.count -gt 1}

Upvotes: 2

trebleCode
trebleCode

Reputation: 2308

Get-ADUser -Filter * -Properties Description | Select Name,Description | Sort Description 

You could add another pipe to Format-List or Format-Table or export with Export-CSV or Export-CliXML

Upvotes: 2

Related Questions