Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

[Powershell] lastlogondate exactly 90 days ago

$
0
0

Dear All,

I beg for help as I'm in a need to build a "GET-ADUSER" command which will find :

1. enabled
2. not used exactly 90 days (not 89 & not 91+)
3. with specific value of "EmployeeID" attribute starting with K* and L0*

I have tried

$90Days = (get-date).adddays(-90)
$colection =$null
$colection = Get-ADUser -resultpagesize 0 -properties * -filter {(lastlogondate -eq $90days) -AND (enabled -eq $True) -and (employeeid -like "K*" -or employeeid -like "L0*")}

and then I tried:

Search-ADAccount -AccountInactive -TimeSpan 90.00:00:00 | ?{$_.enabled -eq $true} 
But I need 90 days old, and not older than 90 days, not even 91 day old. but Exactly 90 days old.

Please help.


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>