0
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!!!
If you change the service to automatic, or delayed, it should automatically start. No need to script anything. – LPChip – 2018-01-27T17:13:42.667
I want this service to start / stop for specific user only. – 0xDEAD BEEF – 2018-01-27T17:16:47.440