I have a pclist.csv file like this:
----------------------------------------------
| Name | LastLogonTimestamp | Some Other Data |
-----------------------------------------------
| 2342 | 23/05/2012 | Blah Blah Blah |
-----------------------------------------------
| 3433 | | Yada Yada Yada |
-----------------------------------------------
As you can see, some of the LastLogonTimestamp cells don't contain any data and some do.
I'm trying to examine this .csv using a powershell function like this:
$assets = import-csv pclist.csv
Function ActiveDesktop
{
foreach ($asset in $assets)
{
if ($asset.'LastLogonTimestamp' -le {get-date.adddays(-90) -format "ddMMyyyy"})
{write-host $asset.Name, $asset."LastLogonTimestamp"}
}
}
I want to see which PCs are inactive, but running the query doesn't return anything. Can anybody point me in the right direction?
Get all records with empty
LastLogonTimestamp
or older then 90 days: