# Uncomprehensive error with Get-ADUser

**URL:** <https://forums.powershell.org/t/uncomprehensive-error-with-get-aduser/23603>\
**Category:** PowerShell Help\
**Created:** [February 19, 2024, 10:52am UTC](https://forums.powershell.org/t/uncomprehensive-error-with-get-aduser/23603 "2024-02-19T10:52:44Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Oli](https://avatars.discourse-cdn.com/v4/letter/o/2bfe46/32.png) [@Oli](https://forums.powershell.org/u/Oli)\
**Post date:** [February 19, 2024, 10:52am UTC](https://forums.powershell.org/t/uncomprehensive-error-with-get-aduser/23603/1 "2024-02-19T10:52:44Z")

</div>

Hi all,

I’m coming here to find a solution to a simple command not working with Get-ADUser.  
I type in a PS admin box this command:  
Get-ADUser -Filter {Enabled -eq $true -and LastLogonTimeStamp -lt $((Get-Date).AddDays(-90).ToFileTime())} -Server [MyDCServer.com](http://MyDCServer.com)

And I get the following error:  
Cannot process argument because the value of argument “path” is not valid. Change the value of the “path” argument and run the operation again.

What am I doing wrong?

Thanks,  
Olivier

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [February 19, 2024, 2:42pm UTC](https://forums.powershell.org/t/uncomprehensive-error-with-get-aduser/23603/2 "2024-02-19T14:42:48Z")

</div>

Hi there and welcome!

For future posts, please format your code: [How to format code on PowerShell.org](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/2X/b/bee50c628238f2c076c0504efb6b15f2fb11f002.gif)

Try

```powershell
$Date = (Get-Date).AddDays(-90).ToFileTime()
Get-ADUser -Filter {Enabled -eq $true -and LastLogonTimeStamp -lt $Date}

```

If you need the add the server bit back in you can. Not 100%, but I don’t think the `ToFileTime` method is needed here but I haven’t tested it, so I left it.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [February 24, 2024, 2:07am UTC](https://forums.powershell.org/t/uncomprehensive-error-with-get-aduser/23603/4 "2024-02-24T02:07:07Z")

</div>


