You use Remote Desktop Connection (RDC) to connect to your remote machine or VM to execute test. Tests that run successfully on the VM when I'm logged in and manually starting them works fine. But if I'm not connected to the VM. The tests fails, seems like it cannot execute click/enter commands.
When doing any kind of UI automation, active desktop session is required. The problems that you are encountering is because of not having an active desktop session.
For better understanding on "what's an active desktop session?", please check out this blog post
To keep your desktop action active upon remote desktop disconnect, run below command on command prompt with administrator permission
for /f "skip=1 tokens=2" %s in ('query user %USERNAME%') do (tscon.exe %s /dest:console)
For more information on how tscon work, please check this out