send input on a remote VM doesnt work when no user is logged in

I have a executable built on C++ with SendInput() which I would like to use it a remote host scheduled via Task Scheduler.

The Problem is it doesnt work when the RDP session is minimized or when there is no user logged in and the task kicks off at defined time but the Sendinput function doesnt work at that time.

Does it not work under such scenario?(Remote host and no user logged in / no focus on the Window where to send input)