Forum Discussion
Imadnazim
May 09, 2024Copper Contributor
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...
- May 09, 2024
Hi, Vasil.
This is in relation to the on-premise ActiveDirectory module, not any Azure modules.
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
LainRobertson
May 09, 2024Silver Contributor
Hi, Vasil.
This is in relation to the on-premise ActiveDirectory module, not any Azure modules.
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
Imadnazim
May 10, 2024Copper Contributor
Hello LainRobertson ,
I ran commands as suggested by you. My AD module is different that could be an issue here.
- LainRobertsonMay 10, 2024Silver Contributor
Hi, Imad.
That path suggests the ActiveDirectory module you're seeing may be being imported as a remote session, which may explain the shown error - which is different again to the two previous errors.
What do you see if you run the command below?
If you see the a module with a path like the one above beginning with C:\Windows\system32\WindowsPowerShell, then that's the module you want to make use of, not the one from your screenshot.
Cheers,
Lain