1

I have a server which I connect to with remote desktop connection. I have defined auto login for a particular user. I also have scheduled a batch script to run after logon for that user.

However, when I restart the server and later try to logon with remote desktop for the same user, it seems like it does the actual login when I connect. What I want is to make sure that this user is already logged in. In this way I can ensure that my script is run if a restart or failure has occured. Right now I actually have to connect with RDP to fire this script.

I have defined the variables in winlogin after running regedit.exe (DefaultUsername, DefaultPassword, etc.), and also used the autologon.exe found here http://live.sysinternals.com/. It seems like username, password and domains are correct.

How can I make sure that the user is already logged if a restart has occured? I am probably missing something, but I don't want to connect with RDP in order to start the script.

1 Answer 1

2

Sounds like you want your script to run at computer startup. You can achieve this using the Task Scheduler in Windows server. On the triggers tab in Task click New then choose At Startup from the Begin this task dropdown menu. This works for me. I have a powershell script that I need to run when a server starts up and Task Scheduler does it perfectly.

To start a powershell script, for example, in Task Scheduler on your actions you choose Start a Program, provide the path to the powershell exe, and in the Add Arguments path, provide the path to your script. Doing so will run the powershell script when the server starts up. This breaks you free from depending on a User login to run your script.

This link shows how to create a basic task in Windows Task Scheduler. http://www.howtogeek.com/138159/how-to-enable-programs-and-custom-scripts-to-run-at-boot/

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .