I'd like to set the Affinity
and Priority
of a service process when it is started (without modifying the service/process code, I don't own the code, it's a 3rd party service).
I know I can do:
$Process = Get-Process MyService
$Process.ProcessorAffinity = 4
in PowerShell to change the Affinity
of the process or prefix the command path with:
cmd.exe /c start "Some Process Name" /affinity 4
However, neither of these are applicable to changing the Affinity
and Priority
of the service's process automatically everytime the service is started) How can I do this without using some 3rd-party app that 'maintains' process affinity across restart (I'd really like to write/create a solution myself and not rely yet another app to 'configure' windows).