GD,
I have used the following command succesfully in Server 2012 R2, but it does not work in Server 2016:
runas /noprofile /user:DOMAIN\administrator "taskkill /f /im name_of_service.exe"
Anybody any idea what has changed in Server 2016?
If I want to close something like notepad.exe that works. But not spoolsv.exe for example
runas /noprofile /user:DOMAIN\administrator "taskkill /im spoolsv.exe /f"
Whereas when I run: taskkill /im spoolsv.exe /f That does work.
So it seems to be the combination of Server 2016, runas and taskkill what has changed.
No error message to be found anywhere.
cmd /k
before taskkill. If you are killing a service, my guess would be it is restarting due to recovery action.