Windows security and WinSCP connection profiles
I have a Windows scheduled task and I created that generates and runs an WinSCP script to connect to a SFTP site and transfer files. I also created the workspace and connection in WinSCP. The task works fine under my Windows user Id, but when another admin user tries to run the scheduled task, they get this in the log file:
< 2025-06-25 12:05:07.881 Script: Authenticating...
. 2025-06-25 12:05:07.882 Asking user:
. 2025-06-25 12:05:07.882 **Continue connecting to an unknown server and add its host key to a cache?**
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 The host key is not cached for this server:
. 2025-06-25 12:05:07.882 dataintegration.myblueship.com (port 22)
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 You have no guarantee that the server is the computer you think it is.
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 The rsa2 key fingerprint is:
. 2025-06-25 12:05:07.882 ssh-rsa 2048 YCiQxF6PkjPbrnAEBmO6KOl8s3q6LhA6HVAl7fBKQNQ
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 If you trust this host, select Accept to add the key to WinSCP's cache and carry on connecting.
. 2025-06-25 12:05:07.882 If you want to carry on connecting just once, without adding the key to the cache, select Connect Once.
. 2025-06-25 12:05:07.882 If you do not trust this host, select Cancel to abandon the connection.
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 In scripting, you should use a -hostkey switch to configure the expected host key. ()
< 2025-06-25 12:05:07.882 Script: Continue connecting to an unknown server and add its host key to a cache?
< 2025-06-25 12:05:07.882 The host key is not cached for this server:
< 2025-06-25 12:05:07.882 dataintegration.myblueship.com (port 22)
< 2025-06-25 12:05:07.882 You have no guarantee that the server is the computer you think it is.
< 2025-06-25 12:05:07.882 The rsa2 key fingerprint is:
< 2025-06-25 12:05:07.882 ssh-rsa 2048 YCiQxF6PkjPbrnAEBmO6KOl8s3q6LhA6HVAl7fBKQNQ
< 2025-06-25 12:05:07.882 If you trust this host, select Accept to add the key to WinSCP's cache and carry on connecting.
< 2025-06-25 12:05:07.882 If you want to carry on connecting just once, without adding the key to the cache, select Connect Once.
< 2025-06-25 12:05:07.882 If you do not trust this host, select Cancel to abandon the connection.
< 2025-06-25 12:05:07.882 In scripting, you should use a -hostkey switch to configure the expected host key.
. 2025-06-25 12:05:18.086 Answer: Cancel
. 2025-06-25 12:05:18.086 Attempt to close connection due to fatal exception:
* 2025-06-25 12:05:18.086 Host key fingerprint is ssh-rsa 2048 YCiQxF6PkjPbrnAEBmO6KOl8s3q6LhA6HVAl7fBKQNQ.
* 2025-06-25 12:05:18.086 (Exception) **Host key wasn't verified!**
. 2025-06-25 12:05:18.086 Closing connection.
What can I do to allow them to run the scheduled task successfully?
< 2025-06-25 12:05:07.881 Script: Authenticating...
. 2025-06-25 12:05:07.882 Asking user:
. 2025-06-25 12:05:07.882 **Continue connecting to an unknown server and add its host key to a cache?**
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 The host key is not cached for this server:
. 2025-06-25 12:05:07.882 dataintegration.myblueship.com (port 22)
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 You have no guarantee that the server is the computer you think it is.
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 The rsa2 key fingerprint is:
. 2025-06-25 12:05:07.882 ssh-rsa 2048 YCiQxF6PkjPbrnAEBmO6KOl8s3q6LhA6HVAl7fBKQNQ
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 If you trust this host, select Accept to add the key to WinSCP's cache and carry on connecting.
. 2025-06-25 12:05:07.882 If you want to carry on connecting just once, without adding the key to the cache, select Connect Once.
. 2025-06-25 12:05:07.882 If you do not trust this host, select Cancel to abandon the connection.
. 2025-06-25 12:05:07.882
. 2025-06-25 12:05:07.882 In scripting, you should use a -hostkey switch to configure the expected host key. ()
< 2025-06-25 12:05:07.882 Script: Continue connecting to an unknown server and add its host key to a cache?
< 2025-06-25 12:05:07.882 The host key is not cached for this server:
< 2025-06-25 12:05:07.882 dataintegration.myblueship.com (port 22)
< 2025-06-25 12:05:07.882 You have no guarantee that the server is the computer you think it is.
< 2025-06-25 12:05:07.882 The rsa2 key fingerprint is:
< 2025-06-25 12:05:07.882 ssh-rsa 2048 YCiQxF6PkjPbrnAEBmO6KOl8s3q6LhA6HVAl7fBKQNQ
< 2025-06-25 12:05:07.882 If you trust this host, select Accept to add the key to WinSCP's cache and carry on connecting.
< 2025-06-25 12:05:07.882 If you want to carry on connecting just once, without adding the key to the cache, select Connect Once.
< 2025-06-25 12:05:07.882 If you do not trust this host, select Cancel to abandon the connection.
< 2025-06-25 12:05:07.882 In scripting, you should use a -hostkey switch to configure the expected host key.
. 2025-06-25 12:05:18.086 Answer: Cancel
. 2025-06-25 12:05:18.086 Attempt to close connection due to fatal exception:
* 2025-06-25 12:05:18.086 Host key fingerprint is ssh-rsa 2048 YCiQxF6PkjPbrnAEBmO6KOl8s3q6LhA6HVAl7fBKQNQ.
* 2025-06-25 12:05:18.086 (Exception) **Host key wasn't verified!**
. 2025-06-25 12:05:18.086 Closing connection.
What can I do to allow them to run the scheduled task successfully?