locked
exports users information RRS feed

  • Question

  • Hi All i have used the below syntax to pull users information from OU

    Get-ADUser -Filter * -SearchBase "OU=TestOU,DC=ops,DC=contoso,DC=com" -Properties SAMAccountName, EmployeeID, DisplayName, Description, Enabled, 
    LastLogonDate | Select SAMAccountName, EmployeeID, DisplayName, Description, Enabled, LastLogonDate | export-csv C:\output.csv -NoTypeInformation

    will i get the samaccount name as user logon name or user logon name(pre-Windows 2000),  i want to pull user logon name not user logon name(Pre-Windows 2000). experts guide me.

    If i need to pull for completer domain will the below syntax help me

    Get-ADuser -filter * -Properties SAMAccountName, EmployeeID, DisplayName, Description, Enabled, 
    LastLogonDate | Select SAMAccountName, EmployeeID, DisplayName, Description, Enabled, LastLogonDate | export-csv C:\output.csv -NoTypeInformation

    Monday, May 6, 2019 3:57 PM

Answers

All replies

  • Hello,

    It's not this attribut ?

    Get-ADuser -filter * -Properties SAMAccountName, EmployeeID, DisplayName, Description, Enabled,
    LastLogonDate, UserPrincipalName

    Regards

    Monday, May 6, 2019 4:02 PM
  • Hi,

    userPrincipalName is the logon name for the user, you can check these in the User Naming Attributes documentation below:

    User Naming Attributes
    https://docs.microsoft.com/en-us/windows/desktop/ad/naming-properties

    Best regards,
    Leon


    Blog: https://thesystemcenterblog.com LinkedIn:

    Monday, May 6, 2019 4:05 PM
  • Also, if you use -Filter * and do not specify a -SearchBase, you will retrieve information on all users in the domain.

    Richard Mueller - MVP Enterprise Mobility (Identity and Access)

    • Marked as answer by ItsMe-Roger Monday, May 6, 2019 5:12 PM
    Monday, May 6, 2019 4:14 PM
  • Hi,

    I am glad to hear that your issue was successfully resolved.

    If there is anything else we can do for you, please feel free to post in the forum.

    Have a nice day!

    Lavilian


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    If you have feedback for TechNet Subscriber Support, contact tnmff@microsoft.com.

    Tuesday, May 7, 2019 2:41 AM