The Powershell command won't give me the results the correct results. (Get-ADUser -Filter * -Properties * | Select Name, whenCreated | Sort-Object whenCreated)

Jef de Jong 1 Reputation point
2022-05-13T07:11:50.907+00:00

Dear Support,

When i run the following command Get-ADUser -Filter * -Properties * | Select Name, whenCreated | Sort-Object whenCreated it won't show me the correct output.
I want to have a list with all the users and which date it has been created.

But it won't show me the output. Some users it will show the output. Some users it won't.
See screenshot for more information.

201685-screenshot-33.png

When i check the useraccount attribute information under the user information i found the following results.

201637-screenshot-40.png

Is it's possible to retrieve this with an command? Because i see the information is stored.
Please advise how i can accomplished this with an command.

Greetz,
Jeffrey de Jong

Windows for business | Windows Server | User experience | PowerShell
0 comments No comments
{count} votes

3 answers

Sort by: Most helpful
  1. Newbie Jones 1,386 Reputation points
    2022-05-13T12:04:06.17+00:00

    For the ones that don't seem to be working, try bringing back just that account and seeing if its truly blank.

    Get-ADUser -Identity xyz -properties whenCreated | Select-Object Name, whenCreated
    

    You are also getting all properties for all users, which will take much longer than you need. Limit the properties to just the ones you need.

    Get-ADUser -Filter * -Properties whenChanged | Select-Object Name, whenCreated
    

    whenCreated should be a replicated attribute, so it should exist on all domain controllers. It may be worth running the command against different domain controllers to ensure that the replication is working properly. As that may account for some being blank.

    lastLogin and whenChanged for example are not replicated, so you would have to potentially query all domain controllers to get the most recent date.

    0 comments No comments

  2. Newbie Jones 1,386 Reputation points
    2022-05-13T12:12:46.22+00:00

    It's also possible that you don't have full permissions to some objects and that the permissions on some user objects have been modified\broken.

    0 comments No comments

  3. Limitless Technology 39,921 Reputation points
    2022-05-18T07:37:40.923+00:00

    Hello

    Thank you for your question and reaching out.
    I can understand you are having some issues related to Ad users when created Date incorrect result.

    Please try launch AD powershell from a DC or remote server admin tools and run the following command with elevated mode.

    Get-ADUser -filter * -Properties samAccountName,WhenCreated | Select-Object samAccountName,WhenCreated

    Also , please ensure AD replication is good in health and all are synced.


    --If the reply is helpful, please Upvote and Accept as answer--

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.