Count users attributes in AD

This topic contains 5 replies, has 3 voices, and was last updated by Profile photo of Dan Potter Dan Potter 2 months, 2 weeks ago.

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #46831
    Profile photo of Alexander Dubel
    Alexander Dubel
    Participant

    Hello, guys
    I need to count how many user attributes we have in our Active directory.
    The command
    Get-ADUser -identity Administrator -properties *
    gives me all information about attributes but I can't calculate them.
    @(Get-ADUser -identity Administrator -properties *).Count # returns 1
    @(Get-ADUser -identity Administrator -properties *).Length # returns 1
    $output=Get-ADUser -identity Administrator -properties *
    @($output).Count # returns 1
    Please help

    #46835
    Profile photo of Dan Potter
    Dan Potter
    Participant

    fyi, properties * doesn't contain all attributes.

    #46837
    Profile photo of Dan Potter
    Dan Potter
    Participant

    (get-aduser me -Properties * |gm -MemberType property).count

    #46842
    Profile photo of Matt Howard
    Matt Howard
    Participant

    Instead of .Count or .Length, use .PropertyCount

    i.e: (Get-ADUser -Identity Administrator -Properties *).PropertyCount

    • This reply was modified 2 months, 2 weeks ago by Profile photo of Matt Howard Matt Howard.
    #46848
    Profile photo of Alexander Dubel
    Alexander Dubel
    Participant

    Thank you guys.
    Your answers were really fast!
    Both variants are working.

    #46865
    Profile photo of Dan Potter
    Dan Potter
    Participant

    Good one Matt. Hard to break old habits:D

    Get-ADObject -filter * -SearchBase (Get-ADRootDSE).schemaNamingContext | where objectclass -like "attributeschema" |select name

    now figure out how you can find those only related to the user class:D

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.