Topic "Session Logging not working in power shell script"

Author Message
lanman73

Guest


I've tried everything to get Session Logging to work in this script. Does anyone have any idea's a can try. Below is the script I'm using.



# Load WinSCP .NET assembly
[Reflection.Assembly]::LoadFrom("C:\Program Files (x86)\WinSCP\WinSCPnet.dll") | Out-Null

# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::Sftp
$sessionOptions.HostName = "some.site.com"
$sessionOptions.UserName = "User"
$sessionOptions.Password = "SomePassword"
$sessionOptions.SshHostKeyFingerprint = "xxxxxxxxxxxxxx"
$sessionOptions.SessionLogPath = "C:\Logs\SessionLogs\sessionlog.txt"

$session = New-Object WinSCP.Session

$session.Open($sessionOptions)

$session.PutFiles($DailyFileInfo.FullName, $RemoteDailyPath).Check()

$session.Dispose()
lanman73

Guest


The member "SessionLogPath" was not found for the specified .NET object.

Does anyone know the correct member for Session logging using the .Net object?
martin
[View user's profile]
Site Admin
Joined: 2002-12-10
Posts: 24512
Location: Prague, Czechia
The SessionLogPath is a property of the Session class, not the Sessionptions class:
https://winscp.net/eng/docs/library_session
Advertisements

You can post new topics in this forum






Search Site

What is WinSCP?

It is award-winning SFTP client, SCP client, FTPS client and FTP client integrated into one software program for file transfer to FTP server or secure SFTP server. [More]

And it's free!

Donate

About donations

$9   $19   $49   $99

About donations

Recommend

WinSCP Privacy Policy

WinSCP License