Intermittent "Access is denied" when opening session with no session log created

Advertisement

Jon_Boy
Joined:
Posts:
3

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 ($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      :
Some redacted information from a succesful session open log:
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
Any suggestions as to how to determine what the "Access is denied" message relates to and how to resolve would be much appreciated.

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: Intermittent "Access is denied" when opening session with no session log created

The error relates to starting of WinSCP.exe by the WinSCP .NET assembly.
It might be an antivirus application blocking the .exe temporarily or similar.

Reply with quote

Jon_Boy

Re: Intermittent "Access is denied" when opening session with no session log created

Thanks Martin. The issue was indeed related to AV (Symantec Endpoint Protection in this case).

Reply with quote

Advertisement

You can post new topics in this forum