SAM2009
asked on
How to compare dates from csv with PowerShell?
Hi,
In PowerShell if in my csv file I have the date of lastlogondate in this format: 2019-01-29 10:34:10 AM
I need to get users with lastlogondate older than 90 days. My question is:
Should I compare like this:
1- Where-Object {([datetime]::($_.lastlogo ndate) -le (Get-Date).adddays(-90))
or Like this:
2 -Where-Object {([datetime]::FromFileTime ($_.lastlo gondate) -le (Get-Date).adddays(-90))
In PowerShell if in my csv file I have the date of lastlogondate in this format: 2019-01-29 10:34:10 AM
I need to get users with lastlogondate older than 90 days. My question is:
Should I compare like this:
1- Where-Object {([datetime]::($_.lastlogo
or Like this:
2 -Where-Object {([datetime]::FromFileTime
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER