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

shannra

Its possible that i use an old version?
i only get this output, not an Logfile:
Fehler beim Aufrufen der Methode, da [WinSCP.Session] keine Methode mit dem Namen "SessionLogPath" enthält.
in english
error by use the method because [winscp.session] no method with name "SessionLogPath"

This is how I implemented this:
try
{
    $sessionOptions = New-Object WinSCP.SessionOptions
    $sessionOptions.Protocol = [WinSCP.Protocol]::$protocol
    $sessionOptions.HostName = $hostname
    $sessionOptions.UserName = $username
    $sessionOptions.Password = $password
 
    $session = New-Object WinSCP.Session
    try
    {
        # Will continuously report progress of synchronization
   $Session.SessionLogPath({c:\src\C:\src\Scripts\TEST\log.txt})
        $session.add_FileTransferred( { FileTransferred } )
 
        # Connect
        $session.Open($sessionOptions)
        $session.RemoveFiles("/test/*")
        $synchronizationResult = $session.SynchronizeDirectories(
            [WinSCP.SynchronizationMode]::Remote, $source, $target, $false)
.
.
.
.
.
.
martin

Please set Session.SessionLogPath and attach the log.
shannra

Thanks for you replie, but it seemed not tor work:

I use (its only snippet from the script)
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::$protocol
$sessionOptions.HostName = $hostname
$sessionOptions.UserName = $username
$sessionOptions.Password = $password
 
$session = New-Object WinSCP.Session
try
{
    # Will continuously report progress of synchronization
    $session.add_FileTransferred( { FileTransferred } )
 
    # Connect
    $session.Open($sessionOptions)
    $session.RemoveFiles("/test/*")


I get then in ISE of Powershell:
{WinSCP.SessionRemoteException: Can't get attributes of file
shannra

Want to delete remote files before download via powershell

Hello,

i try your scripts to use the .NET assembly by PowerShell. It works perfectly. Now I want to modify it for one day, but with no success.
I want to empty the remote folder before I upload my files.
I search here this forum and your documentations but still now, i not find a solution.

It this possible or should i use it in another way??