Post a reply

Before posting, please read how to report bug or request support effectively.

Bug reports without an attached log file are usually useless.

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

marcsimard@...

Problem fixed

The problem has been completely addressed by making the following change in the PowerShell code:
Replace
$winscpSession.Dispose     # Close and dispose object. 
 

by
$winscpSession.Dispose()   # Close and dispose object. Note the pair of parentheses 
                           # added at the end of the method name.
martin

Re: Session.Dispose leaves sftp-server.exe ghost behind

Do you have the problem with WinSCP GUI? Please post session log file both from the code and the GUI. Show us your code for WinSCP .NET assembly (WinSCP PowerShell module is a 3rd party project).
MarcSimard

Session.Dispose leaves sftp-server.exe ghost behind

I noticed that I could not manually remove a file just uploaded to a SFTP site by my PowerShell script using Session.PutFiles. This is because the file was locked by a sftp-server.exe process (started by New-WinSCPSession) hanging in the background, even though I could confirm that Session.Dispose was called once the file was uploaded.

Is there a way to properly terminate the sftp-server.exe process once the SFTP operations are completed?

I am using WinSCP-5.17.9-Automation and the WinSCP Powershell module 5.17.8.1.