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:
Thanks in advance!
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() }