How to keep the local console open for Windows Server 2012

By | February 24, 2016

In the previous post it has the instruction on how to keep the local console open. However, it doesn’t work well for Windows Server 2012.

Somehow when you remote desktop the machine, the task in Task Scheduler is triggered. It is not only triggered at disconnection, but also connection of a remote session. It looks like a bug.

To work around the issue, the action to be run needs to know if it is at connection or disconnection. The command query session can find out. Then the command tscon is run conditionally.

Create a command batch, say, named opensession.cmd.

In the task action, let it start the batch file.

Leave a Reply

Your email address will not be published. Required fields are marked *