Intermittent "Access is denied" when opening session with no session log created
We see occasional errors when opening an SFTP session from a PowerShell script. The error rate is probably around 0.1% or lower. In each case, the call is identical to many calls which work without issue. The error reported is "Access is denied", however the SFTP server does not see any connection from PowerShell/WinSCP when this happens nor is there any session log output in the specified log location (
The exception caught in PowerShell is:
Some redacted information from a succesful session open log:
Any suggestions as to how to determine what the "Access is denied" message relates to and how to resolve would be much appreciated.
$fnSession.SessionLogPath
).
The exception caught in PowerShell is:
Exception : System.Management.Automation.MethodInvocationException: Exception calling "Open" with "1" argument(s): "Access is denied" ---> System.ComponentModel.Win32Exception: Access is denied at System.Diagnostics.Process.StartWithCreateProcess (ProcessStartInfo startInfo) at WinSCP.ExeSessionProcess.InitializeChild() at WinSCP.ExeSessionProcess.Start() at WinSCP.Session.Open(SessionOptions sessionOptions) at CallSite.Target(Closure , CallSite , Object , Object ) --- End of inner exception stack trace --- at System.Management.Automation.ExceptionHandlingOps .CheckActionPreference(FunctionContext funcContext, Exception exception) at System.Management.Automation.Interpreter.ActionCa llInstruction`2.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTry CatchFinallyInstruction.Run(InterpretedFrame frame) at System.Management.Automation.Interpreter.EnterTry CatchFinallyInstruction.Run(InterpretedFrame frame) TargetObject : CategoryInfo : NotSpecified: (:) [], MethodInvocationException FullyQualifiedErrorId : Win32Exception ErrorDetails : InvocationInfo : System.Management.Automation.InvocationInfo ScriptStackTrace : at SFTPSessionOpen, file_mover_6.ps1: line 388 at <ScriptBlock>, file_mover_6.ps1: line 1023 PipelineIterationInfo : {} PSMessageDetails :
WinSCP Version 5.17.9 (Build 10905) (OS 6.3.9600 - Windows Server 2012 R2 Datacenter) Command-line: ".\winscp.exe" /xmllog="C:\Users\.\AppData\Local\Temp\wscp0680.0074F6C7.tmp" /xmlgroups /xmllogrequired /nointeractiveinput /dotnet=5.17.9 /ini=nul /log=".\File_Mover_6\Logs\.\WinSCPSessionLogs\WinSCPSession.log" /rawconfig Interface\TryFtpWhenSshFails="0" /console /consoleinstance=_1664_15182554_726