Post a reply

Options
Add an Attachment

If you do not want to add an Attachment to your Post, please leave the Fields blank.

(maximum 10 MB; please compress large files; only common media, archive, text and programming file formats are allowed)

Options

Topic review

ta0147896325

Re: PowerShell/.NET Assembly Error - Recursive calls not allowed

The fix within the development version works without error.

I am able to use the following and works in both cases:

if($session.FileExists($remotePath)) {
{
Write-Host "Remote file exists."
}
else
{
Write-Host "Remote file does not exist."
}

Thank you for all your work!
martin

Re: PowerShell/.NET Assembly Error - Recursive calls not allowed

I have sent you an email with a development version of WinSCP to address you have used to register on this forum.
ta0147896325

Re: PowerShell/.NET Assembly Error - Recursive calls not allowed

Thank you for the fix. It works as expected.

Implemented in PowerShell as function at top of script:

function FileExistsFix
{
[WinSCP.Session]$pSession = $args[0]
[string]$pPath = $args[1]
try
{
$pSession.GetFileInfo($pPath)
return $TRUE
}
catch [$pSession.SessionRemoteException]
{
return $FALSE
}
}

And called within main script body as:

if (FileExistsFix $session $remotePath) {
Write-Host "Remote file exists."
}
else
{
Write-Host "Remote file does not exist."
}
ta0147896325

PowerShell/.NET Assembly Error - Recursive calls not allowed

I receive a "Recursive calls not allowed" error connecting to a Cygwin/OpenSSH system via PowerShell/.NET assembly and issuing a Session.FileExists.

Any recommendation?