I am newbie to powershell and trying to filter required values and need help here.
From csv file which has columns name, u_last_backup, I’m trying to filter only names which are dated other than $strdates 2018-10-17,2018-10-16,2018-10-15,2018-10-14
$hostswithnolatestbackup= import-csv ‘.\hostswithcurrentbackupdate.csv’
foreach($hosts in $hostswithnolatestbackup)
if ($strdates -contains $hosts.u_last_backup)
write-log “server has latest backups”
In this script, though u_last_backup value is in list of $strdates, still I see if loop is not executed and goes to else statement and indeed all host names come up though having latest backup.
What am I missing here? Please suggest.