Re: Can’t Set Debug Log Path
Ah, now I get it! Might be worth updating the description in the documentation to clarify that.
$session.DebugLogPath =
"C:\Users\Dick\Documents\PowerShell\Scripts\WinSCP.debug.log"
Session.SessionLogPath
.
Session
object. Here's the code:
function New-Session {
[WinSCP.Session]$session = New-Object WinSCP.Session
$sessionLogPath = $env:TchPublisherSessionLogPath
if ($sessionLogPath) {
if (!(Test-Path $sessionLogPath)) {
Deny-EnvironmentVariable -description "Session log path" -variable "TchPublisherSessionLogPath" -reason $PATH_DOES_NOT_EXIST
}
$session.sessionLogPath = $sessionLogPath
}
$debugLogPath = $env:TchPublisherDebugLogPath
if ($debugLogPath) {
if (!(Test-Path $debugLogPath)) {
Deny-EnvironmentVariable -description "debug log path" -variable "TchPublisherDebugLogPath" -reason $PATH_DOES_NOT_EXIST
}
$session.debugLogPath = $debugLogPath
}
$debugLogLevel = $env:TchPublisherLogLevel
if ($debugLogLevel) {
if ($debugLogLevel -lt -1 -or $debugLogLevel -gt 1) {
Deny-EnvironmentVariable -description "log level" -variable "TchPublisherLogLevel" -reason "valid values are -1 to 1"
}
$session.debugLogLevel = $debugLogLevel
}
return $session
}
$session.debugLogPath = $debugLogPath
Exception setting "debugLogPath": "Access to the path 'C:\Users\Dick\Documents\PowerShell\Scripts' is denied."
debugLogPath
was the same one I just set for sessionLogPath
.