I want to create login script (win 10 pro) that would star/stop synergy service on logon / logout for specific user.
Problem is that "net start synergy" give access denied 5, since it is not executed from elevated user.
So... is there any workaround that I could use?!
------------ SOLUTION --------------
I used subinacl tool (from Microsoft) to grant user right to start/stop/pause Synergy service
subinacl.exe /service Synergy /grant=KitchenComputer\reinis-ubnt=PTO
Then I used Task scheduler and created two tasks. One tasks was triggered by workstation lock other by workstation unlock (there are such triggers!!!). Then I created simple shell script to stop service with "net stop synergy". To start service I used these shell commands:
if %username% == reinis-ubnt ( net start Synergy )
Regarding subinacl and granting user right to launch service I relied on this resource - http://woshub.com/set-permissions-on-windows-service/
Thank you superuser for support!!!