get-aduser and csv files

I got a very easy script

Get-ADUser -SearchBase "OU=users,OU=orgunit,DC=org,DC=local" -LDAPFilter "((!userAccountControl:1.2.840.113556.1.4.803:=2))" `
     -Properties * | Select IDIdentifierType, sAMAccountName, Mail | `
    Export-Csv -Path c:\Users.csv -NoTypeInformation

as a result I got
How should I modify the script to get
I would like to create a csv file that is filled in with some default values (“” in this case), but I do not know how to tell powershell use empty values instead of AD properties.
Any ideas?

select @{n=“AnySynteticPropertyName”; e={ “Any” + ($valid) + ‘scriptblock’ } }, AnyRealProperty

in your case, if you want empty properties, even better :slight_smile:

Get-ADUser -SearchBase "OU=users,OU=orgunit,DC=org,DC=local" -LDAPFilter "((!userAccountControl:1.2.840.113556.1.4.803:=2))" `
     -Properties * | Select * | Select IDIdentifierType, sAMAccountName, Mail | `
    Export-Csv -Path c:\Users.csv -NoTypeInformation

за оба варианта спасибо большое!
Первый (с Label и Evaluations )успел сам нагуглить, правда :slight_smile:

In case someone know :slight_smile:
Got a script

$filename = "c:\users" + (Get-Date -Format "yyyy-MM-dd-HH-mm-ss") + ".csv"
$mRecordNumber = $null # or set integer to limit number of lines in the resulting CSV file
$mSearchBase = "OU=Users, OU=orgunit, DC=dc,DC=local"
Get-ADUser  `
            -ResultSetSize $mRecordNumber  `
            -SearchBase $mSearchBase  `
            -LDAPFilter "((!userAccountControl:1.2.840.113556.1.4.803:=2))" `
            -Properties * | `
      Select `
      @{L='Manager'; E={""}}| `
    Export-Csv -Path $filename -NoTypeInformation -Encoding UTF8
and the manager field contains 
Manager                              : CN=ivanov,OU=orgunit,DC=dc, DC=local 
Is there a way to get GivenName of that particular user in the run-time?

smth like

@{L='Manager'; E={Get-ADUser $.Manager -Properties .GivenName }}|


You can try below given script :

Get-ADUser -Filter * -SearchBase ‘OU=Users & Computers, DC=aaaaaaa, DC=com’ -Properties DisplayName | select -expand displayname | Export-CSV “ADUsers.csv”


Get-ADUser -Filter * -SearchBase “ou=OU,dc=Domain,dc=com” -Properties Enabled, CanonicalName, Displayname, Givenname, Surname, EmployeeNumber, EmailAddress, Department, StreetAddress, Title | select Enabled, CanonicalName, Displayname, GivenName, Surname, EmployeeNumber, EmailAddress, Department, Title | Export-CSV “C:\output.csv”

Thanks a great deal!