Re: Test-Path -exclude equivalent for remote path.
$files = $session.ListDirectory("/home/user").Files | Where-Object { (-not $_.IsDirectory) -and ($_.Name -ne "test.txt") }
if ($files)
{
Write-Host "Files " $files " found"
}
See https://winscp.net/eng/docs/library_example_listing_files_matching_wildcard