How can I run a command in windows that is triggered/detects logging in remotely vs local?

280 views Asked by At

I'm running windows 2008 server. I tried googling and looking on stackoverflow for doing this without adequate results.

I want to run a bit of automation on login/unlock of my windows box. What the automation should do should be different based on whether I'm logging in/unlocking the computer locally vs remotely. What the automation actually does is irrelevant to this question.

Some context: If I login/unlock locally I want to start a program. If login remotely I want to kill that program (I already have scripts to do both). I just don't know how to trigger each script based on the login type.

Is there a way to detect or trigger based on the type of login/unlock remote vs local?

1

There are 1 answers

0
evan On BEST ANSWER

Create 2 tasks

  • Administrative Tools
  • Task Scheduler
  • Action -> Create Task
  • Triggers Tab
  • New Button
  • Begin Task -> On connection to user session
  • Either: Connection from remote computer OR Connection from local computer