Forum Discussion

Imadnazim's avatar
Imadnazim
Copper Contributor
May 09, 2024
Solved

Get-aduser is not working in PS7 if i am trying to filter user using attribute Whencreated.

below code is working in PS 5.1 but Not in PS 7.4.2   $when = $(Get-Date).AddDays(-3).date $data = Get-ADUser -Filter {whenCreated -ge $When} $data.count   Error: Get-ADObject: Error parsing qu...
  • LainRobertson's avatar
    LainRobertson
    May 09, 2024

    VasilMichev 

     

    Hi, Vasil.

     

    This is in relation to the on-premise ActiveDirectory module, not any Azure modules.

     

    Imadnazim 

     

    Your post is somewhat confusing since your example uses "-ge" yet the error reports "-gt". Even so, I've tried both under PowerShell 7.4.2 and cannot reproduce the issue.

     

    Can you please check your example in this post is accurate?

     

     

    Also, check both the module and (optionally) the command to ensure it's not coming from an alternate installation.

     

    Verifying commandlet(s):

     

    Verifying modules(s):

     

    Cheers,

    Lain

Resources