@Murali perhaps you could also take advantage of the ‘Console’ session of the machine where the script is supposed to run. Instead of having the RDP window minimized, you could open CMD as administrator and execute the ‘query session’ command. Locate the ID of the rdp-tcp session you are currently connected to, and use the tscon command, so as to send your current session to the console:
Your RDP window will close, and the current session will be sent to the console.
As a result, the script will run unattended, without having to care about the RDP window.