ScheduledTasksManager is a PowerShell module for managing both local and clustered scheduled tasks on Windows systems. It supports operations in standalone environments as well as Windows Server Failover Clusters, extending the capabilities of the built-in ScheduledTasks module from Microsoft.
Documentation automatically updated at tablackburn.github.io/ScheduledTasksManager
ScheduledTasksManager provides comprehensive functions for managing scheduled tasks in Windows environments, with special focus on clustered scenarios:
- Clustered Task Management: Register, enable, disable, start, stop, and monitor scheduled tasks across failover cluster nodes
- Task Information & Monitoring: Retrieve detailed task information, run history, and cluster node details
- Configuration Management: Export and import task configurations for backup, migration, and deployment
- Advanced Filtering: Filter tasks by state, type, and ownership across cluster nodes
- Credential Management: Secure authentication with cluster nodes using credentials or CIM sessions
Managing scheduled tasks in Windows Server Failover Clusters can be complex and error-prone. This module addresses common challenges:
- Simplified Cluster Operations: Single functions handle cluster-aware task management
- Reduced Administrative Overhead: Automate task deployment and monitoring across multiple nodes
- Enhanced Reliability: Built-in error handling and validation for cluster operations
- Standardized Workflows: Consistent PowerShell function patterns for task management
- Enterprise Ready: Supports credential delegation and secure remote management
- Windows PowerShell 5.1 or PowerShell 7+
- Windows Server with Failover Clustering feature (for cluster functions)
- Appropriate permissions to manage scheduled tasks
Install from PowerShell Gallery:
Install-Module -Name ScheduledTasksManager -Repository PSGallery# Import the module
Import-Module ScheduledTasksManager
# Get all clustered scheduled tasks
Get-StmClusteredScheduledTask -Cluster "MyCluster"
# Get detailed task information including run duration
Get-StmClusteredScheduledTaskInfo -Cluster "MyCluster" -TaskName "BackupTask"
# Start a clustered task and wait for completion
Start-StmClusteredScheduledTask -Cluster "MyCluster" -TaskName "BackupTask"
Wait-StmClusteredScheduledTask -Cluster "MyCluster" -TaskName "BackupTask" -Timeout 300
# Export task configuration for backup
Export-StmClusteredScheduledTask -Cluster "MyCluster" -TaskName "BackupTask" -FilePath ".\BackupTask.xml"
# Import task configuration to another cluster
Import-StmClusteredScheduledTask -Cluster "NewCluster" -Path ".\BackupTask.xml"| Function | Description |
|---|---|
Get-StmClusteredScheduledTask |
Retrieve clustered scheduled tasks from a failover cluster |
Get-StmClusteredScheduledTaskInfo |
Get detailed task information including run times and duration |
Get-StmClusteredScheduledTaskRun |
Get task run history from all cluster nodes |
Register-StmClusteredScheduledTask |
Register a new clustered scheduled task |
Unregister-StmClusteredScheduledTask |
Remove a clustered scheduled task |
Enable-StmClusteredScheduledTask |
Enable a disabled clustered task |
Disable-StmClusteredScheduledTask |
Disable a clustered task (creates backup) |
Start-StmClusteredScheduledTask |
Manually start a clustered task |
Stop-StmClusteredScheduledTask |
Stop a running clustered task |
Wait-StmClusteredScheduledTask |
Wait for a clustered task to complete |
Export-StmClusteredScheduledTask |
Export task configuration to XML |
Import-StmClusteredScheduledTask |
Import task configuration from XML |
| Function | Description |
|---|---|
Get-StmScheduledTask |
Retrieve scheduled tasks from local or remote computers |
Get-StmScheduledTaskInfo |
Get detailed task information with run duration |
Get-StmScheduledTaskRun |
Get task run history with event details |
Disable-StmScheduledTask |
Disable a scheduled task on local or remote computers |
Enable-StmScheduledTask |
Enable a scheduled task on local or remote computers |
Export-StmScheduledTask |
Export task configuration to XML |
Import-StmScheduledTask |
Import task configuration from XML |
Register-StmScheduledTask |
Register a new scheduled task |
Unregister-StmScheduledTask |
Remove a scheduled task |
Start-StmScheduledTask |
Manually start a scheduled task |
Stop-StmScheduledTask |
Stop a running scheduled task |
Wait-StmScheduledTask |
Wait for a scheduled task to complete |
| Function | Description |
|---|---|
Get-StmClusterNode |
Retrieve cluster node information |
# Get all tasks on a cluster
$tasks = Get-StmClusteredScheduledTask -Cluster "YOURCLUSTER"
# Filter by state
$runningTasks = Get-StmClusteredScheduledTask -Cluster "YOURCLUSTER" -TaskState Running
# Get task with credentials
$cred = Get-Credential
Get-StmClusteredScheduledTask -Cluster "YOURCLUSTER" -Credential $cred# Get recent task runs from all cluster nodes
Get-StmClusteredScheduledTaskRun -Cluster "YOURCLUSTER" -TaskName "BackupTask" -MaxRuns 10
# Get local task runs with detailed timing
Get-StmScheduledTaskRun -TaskName "MyTask" -MaxRuns 5# Export all tasks from a cluster to a directory
$tasks = Get-StmClusteredScheduledTask -Cluster "OldCluster"
foreach ($task in $tasks) {
Export-StmClusteredScheduledTask -Cluster "OldCluster" -TaskName $task.TaskName -FilePath ".\Backup\$($task.TaskName).xml"
}
# Import all tasks to a new cluster
Import-StmClusteredScheduledTask -Cluster "NewCluster" -DirectoryPath ".\Backup" -Force# All functions support standard PowerShell error handling
try {
Start-StmClusteredScheduledTask -Cluster "YOURCLUSTER" -TaskName "NonExistent" -ErrorAction Stop
}
catch {
Write-Warning "Task failed: $($_.Exception.Message)"
}- Module Help:
Get-Help about_ScheduledTasksManager - Function Help:
Get-Help Get-StmClusteredScheduledTask -Full - Online Docs: tablackburn.github.io/ScheduledTasksManager
- Examples: Each function includes comprehensive examples
- Issues: Report bugs or request features on GitHub Issues
- Questions: Use GitHub Discussions for general questions
- Documentation: Check the
docs/folder for detailed help files
- PowerShell Gallery: ScheduledTasksManager
- GitHub Repository: tablackburn/ScheduledTasksManager
This project was developed with assistance from Claude by Anthropic.
Trent Blackburn - Primary developer and maintainer
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
- License: See LICENSE file
- Changelog: See CHANGELOG.md for version history
The module includes comprehensive Pester tests with 93%+ code coverage. Run tests with:
./build.ps1 -Task Test