I am trying to add some logic with catching the errors and doing something later on that error. But i can seem to cature the error. Can someone see what i am doing wrong?
Invoke-Command -ComputerName $server -Credential $cred -ScriptBlock {
$sdate= get-date -UFormat %m/%d/%Y
$sdate
Try
{
$procs = get-process -name dbbackex|select id, name, starttime|Where-Object {$_.starttime -NotContains $sdate}
}
Catch
{
Write-Host $_.Exception.Message
}
$procs|ft
}