Jenkins ssh launch windows server2012 agent "[SSH] The remote user's environment is: ERROR: null"

Per the Microsoft announcement, Windows Server 2012 and Windows Server 2012 R2 stopped receiving security updates in November 2023. The Jenkins support policy for Windows classifies that as “Level 4 - unsupported”.

The OpenSSH server for Windows lists Windows Server 2022, Windows Server 2019, Windows 11, and Windows 10 as the versions that support the Microsoft OpenSSH server.

I think that you’re more likely to be successful using an inbound agent from Windows Server 2012 to the Jenkins controller rather than trying to manage the agents with SSH.