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

rzeski007

Re: PowerShell – SFTP / $session.PutFiles - File transfer status

Hi Martin
I did not quite say it correctly. I need to be notified by e-mail after successfully copying the file or an error while copying the file.

it just needs confirmation of the file transfer progress. Success / Failed
rzeski007

PowerShell – SFTP / $session.PutFiles - File transfer status

Hello
anyone is able to help me how can I get status of transfer file with use .NET assembly PowerShell script on my mail? How and where do I need to modify my script?

Script generated by WinSCP below:
# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"
# Set up session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = "ip_sftp_server"
    UserName = "username"
    Password = "password"
    SshHostKeyFingerprint = "ssh-rsa 2048 =***"
}
$session = New-Object WinSCP.Session
try
{
    # Connect
    $session.Open($sessionOptions)
    # Transfer files
    $session.PutFiles("C:\Users\admin\Desktop\test.txt", "/remote_folder/*").Check()
}
finally
{
    $session.Dispose()
}

Thanks in advance!