Is there a way to run commands automatically when user logs in with SSH to Windows Server?
I tried to implement this using the AutoRun
in Command Processor registry, which runs commands when any cmd.exe
is started, but due to the complexity of the script in question, this just ends up in endless recursion every time no matter how I try to fix the situation.
I also don't want to run these commands when it's not SSH, but if it's a working option to check it's the first CMD
, not anything spawned inside it, I can check the existence of SSH_TTY
variable to exclude non-ssh logins.