request to complete the powershell script

SR Zak
SR Zak used Ask the Experts™
on
Hi Experts,

I want to complete this script I want to the script to connect to SFTP site and transfer files from D:\testfolder\*.*  to the remote directory /remotesftp/testfolder/*.* , can someone help

Below is the initial script

# Load WinSCP .NET assembly
Add-Type -Path "WinSCPnet.dll"

# Set up session options
$sessionOptions = New-Object WinSCP.SessionOptions -Property @{
    Protocol = [WinSCP.Protocol]::Sftp
    HostName = "xxxxxsftp.domain.com"
    UserName = "testsftp"
    Password = "tests5F7p"
    SshHostKeyFingerprint = "ssh-rsa 1024 fashghrhyjmukjfgvjhgfhjtr="
}

$sessionOptions.AddRawSettings("FSProtocol", "2")

$session = New-Object WinSCP.Session

try
{
    # Connect
    $session.Open($sessionOptions)

   
}
finally
{
    $session.Dispose()
}
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Managing Consultant
Commented:
You should probably ask this on a WinSCP forum.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial