get-aduser just one property

This topic contains 1 reply, has 2 voices, and was last updated by  Olaf Soyk 2 months, 3 weeks ago.

  • Author
    Posts
  • #76331

    nkaretnikov
    Participant

    Hello!

    $mFilename = "c:\import\users" + (Get-Date -Format "yyyy-MM-dd-HH-mm-ss") + ".csv"
    $mRecordNumber = 1 # $null for no limit or 1...N to limit number of lines in the resulting CSV to N
    $mSearchBase = "CN=Konstantin Nikolov,CN=Users,DC=v-lexmark,DC=com"
    Get-ADUser  -ResultSetSize $mRecordNumber `
                -SearchBase $mSearchBase `
                -LDAPFilter "((!userAccountControl:1.2.840.113556.1.4.803:=2))" `
                -Properties GivenName | Select GivenName

    gives me
    GivenName
    ———
    Konstantin
    output

    How to get just "Konstantin"?
    Enormous thanks in advance! )

  • #76334

    Olaf Soyk
    Participant

    Basic Powershell knowledge!!

    .... | Select-Object -ExpandProperty GivenName

You must be logged in to reply to this topic.