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

Advertisement

rzeski007
Joined:
Posts:
2
Location:
PL

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!

Reply with quote

Advertisement

rzeski007
Joined:
Posts:
2
Location:
PL

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

Reply with quote

Advertisement

You can post new topics in this forum