Task Scheduler -- Possible to Trigger event on local Unlock but not Remote Desktop login?


this intended task scheduler question, not networking question, welcome on either side of issue:

i believe core question how set trigger activates on local login not on remote desktop login? had thought difference between "on workstation unlock" (local only) and "on connect user session" (local or remote), appears not case, "on workstation unlock" triggered remote desktop login. details follow.

i have computer dual nics, each pointing different unrelated internet connection. operating on assumption can have 1 functional gateway @ time (if bad assumption, need know how route traffic nic based on application or port #, not ip#, far can tell not possible in windows). both relatively slow internet connections, 1 faster download connection (slower upload) via randomly-assigned dynamic ip#. other a faster upload (but slower download) , has static ip. when i'm sitting @ computer, want use faster download better internet performance. when i'm remote, want access computer using connection static ip , benefit of faster upload speeds sending screen images out (in cases, remote connection faster on computer, performance differences between 2 connections relevant -- faster upload makes real difference remote usability).

i have set task scheduler change route instructions assign gateway respective nic local use, don't work remote use. specifically, a few minutes after workstation locks, task scheduler runs script sets gateway static ip nic. part's , confirmed working. , if unlock computer locally, runs script sets gateway faster download dynamic ip nic. , confirmed working.

the problem if connect remotely via remote desktop, connects on fast-upload static ip nic should, connection apparently activates "on workstation unlock" trigger, resets gateway other nic , prevents connection , blocks future connection attempts (because incoming requests remote desktop connection on static ip, , response go out on registered gateway, reset dynamic ip).

i haven't been able find explains difference between "on workstation lock/unlock" , "on connect to/disconnect user session". difference , there option trigger on local workstation login, not on remote desktop login?

this not perfect solution , doesn't answer core question distinguishing between local , remote login, following additional code in script might work:

set terminalserver=false
wmic /namespace:\\root\cimv2\terminalservices path win32_terminalservicesetting terminalservermode>%temp%\tsmode.txt

findstr "0" %temp%\tsmode.txt>nul

if errorlevel 1 set terminalserver=true
del %temp%\tsmode.txt

echo accessing computer remotely: %terminalserver%
echo.

if /i "%terminalserver%" == "true" (
 echo remote desktop session, cannot
 echo change network gateways.
 echo.
 goto :exit
) else (
 echo not remote desktop session, go ahead
 echo , change gateway if want.
 echo.
)

[then existing code change network goes here]

i added question, stops ask user if should change, ensuring never autochanges , breaks remote connection.


colin



Windows Server  >  Platform Networking



Comments

Popular posts from this blog

server manager error: ADAM.events.xml could not be enumerated.

Cannot access Anywhere Access using domain name?

WMI Failure: Unable to update Local Resource Group