Batch File works on Windows 10 but not on Windows Server 2003R2

Advertisement

helm
Joined:
Posts:
1

Batch File works on Windows 10 but not on Windows Server 2003R2

Hi
I have a script in a Batch File that works without any problems on my Windows 10 computer, but when I run it on Windows Server 2003R2 I get a confirm dialog about if I really want to connect since the certificate is not known. According to the server host no local certificate is needed to connect and I have not installed any certificate for this on either machine. Since this is suppose to run in the background I can not get the confirm dialog. WinSCP is compatible to Windows Server 2003 so I wonder what the problem might be. I have no problems connecting with the GUI on Windows Server 2003R2. The (test) script is this:

@echo off

"C:\Program Files (x86)\WinSCP\WinSCP.com" ^
  /log="FilePath\WinSCP.log" /ini=nul ^
  /command ^
    "open ftpes://user:pass@server:port/" ^
    "lcd FilePath" ^
    "cd in/" ^
    "get test.txt" ^
    "exit"

set WINSCP_RESULT=%ERRORLEVEL%
if %WINSCP_RESULT% equ 0 (
  echo Success
) else (
  echo Error
)

exit /b %WINSCP_RESULT%

For this test I just run the .bat file manually. As you may see this is an Explicit SFTP connection.

I have attached two logs. One for Windows 10 and another one for Windows Server 2003R2.
Can you figure out what is wrong.

Thanks in advance

Reply with quote

Advertisement

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

Re: Batch File works on Windows 10 but not on Windows Server 2003R2

As you can see in the log, the server's certificate is not recognized by the Windows certificate store on 2003. Most probably because the store is no longer updated and does not contain a respective root certificate.

You can manually confirm the certificate by adding -certificate switch to the open command:
https://winscp.net/eng/docs/scriptcommand_open#certificate

Reply with quote

Advertisement

You can post new topics in this forum