Author Posts

August 1, 2017 at 11:01 am

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! )

August 1, 2017 at 11:26 am

Basic Powershell knowledge!!

.... | Select-Object -ExpandProperty GivenName