Log File not being created

Advertisement

bah614
Guest

Log File not being created

I'm not sure what I am doing wrong. I have a power script that uses the below code. It won't create the log file. The folder exists, and I have full rights to it. I can created and delete files there just fine. I am using 5.7.6

# Load WinSCP .NET assembly
Add-Type -Path "C:\Program Files (x86)\WinSCP\WinSCPnet.dll"

# Setup session options
$sessionOptions = New-Object WinSCP.SessionOptions
$sessionOptions.Protocol = [WinSCP.Protocol]::ftp
$sessionOptions.HostName = "65.82.131.58"
$sessionOptions.UserName = "*****"
$sessionOptions.Password = "*****"
$session = New-Object WinSCP.Session
$session.SessionLogPath = "C:\WinSCPLogs\test.xml"

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

Reply with quote

Advertisement

bah614
Guest

FYI I just tried 5.7.7 still no luck (as well as the new 5.7.7 .NET dll). I know the code is executing, because at the end I do a send-mail and that comes through.

Reply with quote

bah614
Guest

Still not sure why it is not logging, but I figured out the issue that I needed the log. Remote folder path is case sensitive. I'd like to get the logging working, but it can be prioritized lower.

Reply with quote

martin
Site Admin
martin avatar
Joined:
Posts:
40,476
Location:
Prague, Czechia

Re: Log File not being created

WinSCP get confused by the .xml extension. You have to use another one. The session log is not XML, it's a plain text file. Use for example "C:\WinSCPLogs\test.log".

Reply with quote

Advertisement

You can post new topics in this forum