get-aduser just one property

Welcome Forums General PowerShell Q&A get-aduser just one property

This topic contains 1 reply, has 2 voices, and was last updated by

 
Participant
1 year, 5 months ago.

  • Author
    Posts
  • #76331

    Participant
    Points: 0
    Rank: Member

    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

    Participant
    Points: 420
    Helping Hand
    Rank: Contributor

    Basic Powershell knowledge!!

    .... | Select-Object -ExpandProperty GivenName

The topic ‘get-aduser just one property’ is closed to new replies.