trying to pull attributes from get-aduser

Hi - trying to understand how I can add a field from User attributes (employeeID) to this but can’t seem to figure out the correct syntax. Here’s what I have:

Import-Module ActiveDirectory
Get-ADUser -filter {Enabled -eq $True -and PasswordNeverExpires -eq $False} –Properties SamAccountName,mail,DistinguishedName,pwdLastSet,msDS-UserPasswordExpiryTimeComputed,CanonicalName |
Select SamAccountName,mail,DistinguishedName,
@{L="OU";E={($_.CanonicalName -split '/')[0..((($_.CanonicalName -split '/').count) - 2)] -join '/'}},
@{L="Password Last Set"; E={[datetime]::FromFileTime($_."pwdLastSet")}},
@{L="Password Expiry Date";E={[datetime]::FromFileTime($_."msDS-UserPasswordExpiryTimeComputed")}} | 
Export-CSV "C:\temp\PasswordExpirationReportv3.csv" -NoTypeInformation -Encoding UTF8

EmployeeID does not belong to the default attribute set Get-ADUser returns. You will have to specify it along with the other properties you already have for your parameter -Properties.

… and - of course - select it with your Select-Object. :wink:

[quote quote=217101]EmployeeID does not belong to the default attribute set Get-ADUser returns. You will have to specify it along with the other properties you already have for your parameter -Properties.

…. and – of course – select it with your Select-Object. :wink:

[/quote]

Thanks Olaf !