I have an already developed timer job that is running on front end servers, but I want to set it to run on application servers only.
Can I do this with PowerShell without modifying any code of the timer job?
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It only takes a minute to sign up.Sign up to join this community
The solution posted by Benny Doesnt work. Enable disable atimer job with powershell enables/disables on all servers regardless of which server you execute the powershell commands.
The only way to do this is with development in the jobconstructor specify the server you want the job to run, maybe by reading it from the FARM property bag.
Here's an example of how to create a new Timer Job for a specific server. Check out the very last code block. It does require a new constructor for your Timer Job that accepts a servername as a parameter.
If you have globally deployed your solution, it should be possible. Start by disable the timer job on the WFE:
Get-SPTimerJob custom-timer-job | Disable-SPTimerJob
Then, enable the same timer job on your application server:
Get-SPTimerJob custom-timer-job | Enable-SPTimerJob
To learn more on how to manage timer jobs in SharePoint, read the article Use Windows PowerShell cmdlets to manage timer jobs in SharePoint 2013.