Can’t Set Debug Log Path
I’m getting a strange error creating a
I consistently get an error on this line:
The error message:
I didn’t see anything in the documentation that the two paths have to be different. What am I doing wrong?
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
The path I was going to store forException setting "debugLogPath": "Access to the path 'C:\Users\Dick\Documents\PowerShell\Scripts' is denied."
debugLogPath
was the same one I just set for sessionLogPath
.
I didn’t see anything in the documentation that the two paths have to be different. What am I doing wrong?