No XML log file using PowerShell and the .NET Assembly
I'm trying to log transfers by modifying one of the supplied scripts in the script examples section. My transfers, and everything else works fine, but when I define:
and run my script, the files get transferred, and I have a SessionLog...but no XML log. After the script is run, I run:
to see what is defined, and the XmlLogPath is empty?
Below is what I have defined as my session and sessionOptions:
Thoughts?
:edit: Removed a "#" from where I was testing something and forgot to uncomment the line before posting the code snippet.
$session.XmlLogPath = "D:\some\path\here.xml"
and run my script, the files get transferred, and I have a SessionLog...but no XML log. After the script is run, I run:
$session
to see what is defined, and the XmlLogPath is empty?
ExecutablePath : AdditionalExecutableArguments : DefaultConfiguration : True DisableVersionCheck : True IniFilePath : ReconnectTime : 10675199.02:48:05.4775807 DebugLogPath : SessionLogPath : D:\some\path\log.log XmlLogPath : Timeout : 00:01:00 Output : {winscp> option batch on, batch on , winscp> option confirm off, confirm off ...} Opened : UnderlyingSystemType : WinSCP.Session
Below is what I have defined as my session and sessionOptions:
# Load WinSCP .NET assembly [Reflection.Assembly]::LoadFrom("D:\Program Files (x86)\WinSCP\WinSCPnet.dll") | Out-Null # Setup session options $sessionOptions = New-Object WinSCP.SessionOptions $sessionOptions.Protocol = [WinSCP.Protocol]::Sftp $sessionOptions.HostName = "1.2.3.4" <-- obviously not real IP $sessionOptions.UserName = "someftpusername" $sessionOptions.Password = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($bPswd) $sessionOptions.SshHostKeyFingerprint = "ssh-rsa 2048 xx::xx" <-obviously not real fingerprint $session = New-Object WinSCP.Session $Session.DisableVersionCheck = "1" $Session.XmlLogPath = "D:\some\path\log.xml" $Session.SessionLogPath = "D:\some\path\.log"
Thoughts?
:edit: Removed a "#" from where I was testing something and forgot to uncomment the line before posting the code snippet.
Last edited by T on 2014-03-27 15:44; edited 1 time in total