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

I want filter Get-ADComputer -Properties PasswordLastSet by date.

$
0
0

I have a functional script that grabs the Get-ADComputer -Properties PasswordLastSet and displays the computer name and date. What I want is to filter out systems by the date, so I only see systems 30 days older than the date run. Here is what I have that works:

$computers = get-content C:\Scripts\computerlist.txt
ForEach ($comp in $computers)
{
Get-ADComputer $comp -Properties PasswordLastSet | Select-Object Name,PasswordLastSet | Export-CSV C:\Scripts\PasswordLastSet.csv -append -force -NoTypeInformation
}

How do I filter based on the results (date) of PasswordLastSet?


Please mark my post as helpful or the answer or better yet.... both! :) Thanks!


Viewing all articles
Browse latest Browse all 21975

Trending Articles