WinSCP.com returns exit code -1073741819 when automation runs under impersonated user

Advertisement

rrasal
Joined:
Posts:
3

WinSCP.com returns exit code -1073741819 when automation runs under impersonated user

Trying to SFTP from website (running under IIS).
When try to run code through user impersonation, process is not starting.
It returns exit code "-1073741819" but doesn't return any error text or output.
Impersonated user is Administrator on the machine, so ideally user should have full access right.
If we execute same commands manually by logging onto server with same user everything works fine.

If we remove impersonation then automation part also works perfectly fine.
This time it runs under <machine_name>$ user.


To me it looks like something has to do with impersonation.

**Note: Recently we migrated from Windows Server 2008 to 2012
Same code was working fine with 2008 and WinSCP version 4.3.7 (build 1679)


Details
----------------------------------------------------------
WinSCP Version 5.7.6 (Build 5874) (OS 6.3.9600 - Windows Server 2012 R2 Standard)
Transfer Protocol : SFTP
Mode : Automation using impersanation

CODE BLOCK
----------------------------------------------------------
try
{
Process _proc = new Process();

_proc.StartInfo.UseShellExecute = false;
_proc.StartInfo.CreateNoWindow = true;
_proc.StartInfo.FileName = "C:\Program Files (x86)\WinSCP\winscp.com";
_proc.StartInfo.RedirectStandardInput = true;
_proc.StartInfo.RedirectStandardError = true;
_proc.StartInfo.RedirectStandardOutput = true;
_proc.StartInfo.Arguments = "/log='<log file path>'"

_proc.Start();
_proc.StandardInput.WriteLine("option batch on");
_proc.StandardInput.WriteLine("option transfer binary");
_proc.StandardInput.WriteLine("option batch abort");
_proc.StandardInput.WriteLine("option confirm off");
_proc.StandardInput.WriteLine("open sftp://<USER_NAME>:<PASSWORD>@<SERVER_IP>:22 -timeout=120 -hostkey='ssh-rsa 1024 xx:ax:aa:aa:ax:aa:ax:xx:xx:xx:ax:xa:xx:xx:ax:aa'");
_proc.StandardInput.WriteLine("Get '<source file path>' '<target file path>'");
_proc.StandardInput.Close();


StreamReader _errorStream = _proc.StandardError;
StreamReader _outputStream = _proc.StandardOutput;

_proc.WaitForExit();

string _stdError = _errorStream.ReadToEnd();
string _stdOutput = _outputStream.ReadToEnd();


int _exitCode = _proc.ExitCode;
} catch (Exception ex) {
ErrorMessage(ex);
} finally {
i.Undo();
}
----------------------------------------------------------

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
40,430
Location:
Prague, Czechia

Re: WinSCP.com returns exit code -1073741819 when automation runs under impersonated user

Thanks for your report.

I have sent you an email with a development version of WinSCP to the address you have used to register on this forum.

This issue is tracked here:
https://winscp.net/tracker/1334

Reply with quote

Advertisement

You can post new topics in this forum