Scheduling tasks|jobs across servers from central location. (Windows Server)

Posted on

A server stack is the collection of software that forms the operational infrastructure on a given machine. In a computing context, a stack is an ordered pile. A server stack is one type of solution stack — an ordered selection of software that makes it possible to complete a particular task. Like in this post about Scheduling tasks|jobs across servers from central location. (Windows Server) was one problem in server stack that need for a solution. Below are some tips in manage your windows server when you find problem about windows, task-scheduler, job-scheduler, , .

Is there any way, how to schedule Windows tasks|jobs on all servers from central location (server)? Has Microsoft any solution for this? I prefer MS or Windows Server built-in functionalities before SW from third party…


[edit]: Sorry for incomprehensibility. I know, that I can manage tasks through “Task Scheduler” on remote server or I can manage them using PowerShell, but that’s not easy centralized management. Cmdlet “Get-ScheduledTask” don’t have “server” parameter, so I need to connect individualy to every server, run for example cmdlet “Get-ScheduledTask”, than run on every task on that server “Get-ScheduledTaskInfo”, because cmdlet “Get-ScheduledTask” itself tells you nothing and this way collect data from all servers? And not to mention editing tasks. That’s really not a simple script. My idea is, that I have for example “Task Scheduler”, but with tasks from all specified servers. Or at least PowerShell cmdlets with better approach to this task. I thought, that managing scheduled tasks on all servers from one place isn’t so uncommon so it should be implemented into Windows Server. Need to write quite complicated scripts on such a common and simple thing….

(btw.. I’m using Windows Server 2012)

So I’m asking, if I missed something, or I really need to write that (quite long) script if I don’t want to buy some third party software.

You can use Group Policy Preferences to create a scheduled task and deploy it via GPO. This is probably the quickest way to get what you’re looking for.

If you’re entitled to System Center licensing, you should also explore System Center Orchestrator.

edit: I was so surprised that there were 4 previous answers that didn’t mention GPO as a possibility, that I wrote a blog post with a quick rundown of how to do this.

By default, the Task Scheduler in Vista+ and Server 2008 R2+ will allow you to connect to a Task Scheduler on another computer.

enter image description here

You can also do so with PowerShell remoting (if you have an OS that supports those cmdlets), or via cmd.exe with WinRM or PSExec, if you want a fully scripted approach.

The PS cmdlets do seem to be lacking for managing scheduled tasks, but I think you’re overestimating the complexity of reporting on tasks, or creating the same task across multiple servers.

The SCHTASKS exe is useful tool for managing tasks programatically:

# Inventory Report
foreach ($server in gc .serverList.txt) {
write-warning $server
SCHTASKS.EXE /s $server /query /fo csv > tasks.csv
$csv = Import-Csv .tasks.csv
$csv | where {$_.taskname.lastindexof("") -eq 0 -OR $_.taskname -match ""\Legacy"" } # Ignore bultin OS tasks from MS

Leave a Reply

Your email address will not be published.