Try this:
$time = ""
$oneshot = $true
$rec = [ordered]@{
Date = ""
Server1 = "."
Server2 = "."
}
Import-CSV C:\junk\Combine.csv -delimiter "|" |
ForEach-Object{
$d = get-date $_."Date " # Note that all property names contain a trailing space!
$d = $d.AddSeconds(-($d.Second)) # convert textual time into a DateTime object and set seconds to zero
if ($oneshot){
$oneshot = $false
$time = $d
}
if ($d -ne $time){ # time isn't the same, dump a new record
$rec.Date = $time
[PSCustomObject]$rec
$time = $d
$rec.Server1 = "."
$rec.Server2 = "."
}
if (($_."Server 1 ").Trim() -ne "."){
$rec.Server1 = ($_."Server 1 ").Trim()
}
if (($_."Server 2 ").Trim() -ne "."){
$rec.Server2 = ($_."Server 2 ").Trim()
}
} | Export-Csv c:\Junk\Combine_NoSec.csv -NoTypeInformation
# Dump the pending record
[PSCustomObject]$rec | Export-Csv c:\Junk\Combine_NoSec.csv -Append -NoTypeInformation