TransWikia.com

Using remote desktop with server with auto logon

Super User Asked on November 26, 2021

I am looking for the workaround for the following problem: there’s .exe file, which must be run at the server startup. It can not be run as is as a service. Whatever I was doing searching internet I was unable to set it up starting on Windows start, the only successful I was in making this .exe auto-start when I log in (using remote desktop).

So the easiest way for me would be to set up auto log-in so that it starts this .exe shortly after the OS start event. However I do not know if I will be able then to connect to the server over network using remote desktop. I would not even try because if this is wrong approach I will lose connection to the server completely and will not be able to fix it.

When I log in using remote desktop I realize it is not as regular console log in, because I only have option to disconnect, and when I am disconnected the login session is still live. Thus if I set up auto log-in in the server (if I will be allowed with my credentials) I am not sure it will be the same as me logging in through remote desktop…

I am lost in it and have no idea what should do to achieve the main objective. And there’s no option for the mistake, and trial and error.

2 Answers

Remote desktop works, also on a auto-login system, so that would work.
But it is probably the wrong solution to your problem.

The Windows Task Scheduler has the option to define a task that runs X minutes after startup of the computer.
First try to setup the exe-file to be run through that. Don't start it immediately after startup as chances are the computer is still initializing a lot of stuff, like the network, various services, etc and your program may have a dependency on one of those. 3 to 5 minutes is usually a good startup delay.
Please note: Some programs won't run as a background process if you start them directly from the Task Scheduler, but they do work if you call them from a batch-file (or Powershell script) and run that batch/script via the Task Scheduler.
It's worth doing a little experimentation.

If the program absolutely needs a logged-in environment to work (it is not designed for running as a background process) then your solution is the fallback.

Answered by Tonny on November 26, 2021

You can connect to an existing login over Remote Desktop, but it locks the session out for any local user. It doesn't terminate any running tasks to do this, it's merely an interaction lockout as far as anyone sitting at that machine would see; a 'curtain' in effect.
If you lose the connection for any reason, the remote session should just start up again when you attempt to relog to it, so long as the remote machine itself has not hung & the disconnect is merely a line-drop.

If you set the machine to auto-login at boot using netplwiz, you can still log to it.
If you need to restart or shut down, use a batchfile on the desktop with shutdown.exe /r or /s

See https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/shutdown for the full syntax

Answered by Tetsujin on November 26, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP