Skip to main content

Windows Task Scheduler Integration

Schedule TextPipe, WordPipe, ExcelPipe, PowerPointPipe, and FileWatcher for unattended execution using Windows Task Scheduler. These examples show how to create scheduled tasks via PowerShell, configure triggers, and set up logging.

TextPipe Scheduled Task

Schedule TextPipe to run a data transformation filter at a set time every day. This is ideal for nightly ETL jobs, daily report processing, or periodic data cleansing.

Command-Line Arguments

Argument Description
/filter:"path" Path to the .fll filter file to execute
/input:"path" Input file path
/inputfolder:"path" Input folder path (processes all matching files)
/output:"path" Output file path
/outputfolder:"path" Output folder path
/mask:"*.csv" File mask for folder processing
/recurse Include subfolders
/silent Suppress all UI dialogs
/overwrite Overwrite existing output files
/log:"path" Write processing log to file

Create Scheduled Task via PowerShell

# Create a scheduled task for nightly TextPipe data transformation
# Run as Administrator

$taskName = "DataMystic - TextPipe Nightly ETL"
$textpipePath = "C:\Program Files\DataMystic\TextPipe\TextPipe.exe"

# Define the action - TextPipe command-line execution
$action = New-ScheduledTaskAction `
    -Execute $textpipePath `
    -Argument '/filter:"C:\Filters\nightly_etl.fll" /inputfolder:"C:\Data\Incoming" /outputfolder:"C:\Data\Processed" /mask:"*.csv" /recurse /silent /overwrite /log:"C:\Logs\textpipe_nightly.log"' `
    -WorkingDirectory "C:\Program Files\DataMystic\TextPipe"

# Trigger: Run daily at 2:00 AM
$trigger = New-ScheduledTaskTrigger -Daily -At "02:00"

# Settings: Allow running on battery, restart on failure
$settings = New-ScheduledTaskSettingsSet `
    -AllowStartIfOnBatteries `
    -DontStopIfGoingOnBatteries `
    -RestartCount 3 `
    -RestartInterval (New-TimeSpan -Minutes 5) `
    -StartWhenAvailable `
    -ExecutionTimeLimit (New-TimeSpan -Hours 2)

# Create the task (runs as SYSTEM for unattended execution)
Register-ScheduledTask `
    -TaskName $taskName `
    -Action $action `
    -Trigger $trigger `
    -Settings $settings `
    -User "SYSTEM" `
    -RunLevel Highest `
    -Description "Nightly ETL: Transform incoming CSV files using TextPipe Pro"

Write-Host "Scheduled task '$taskName' created successfully."
Write-Host "Next run: $(Get-ScheduledTask -TaskName $taskName | Get-ScheduledTaskInfo | Select-Object -ExpandProperty NextRunTime)"

WordPipe Scheduled Task

Schedule WordPipe for batch find-and-replace operations across Word documents. Common scenarios include nightly server-migration link updates and periodic compliance scans.

Command-Line Arguments

Argument Description
/f:"path" Input file or folder path
/s:"find" Search text
/r:"replace" Replacement text
/wordlist:"path" Path to a word list file for multiple replacements
/subfolders Include subfolders
/log:"path" Log file path
/silent Suppress UI dialogs
# Schedule WordPipe for weekly document link updates
$taskName = "DataMystic - WordPipe Server Migration"
$wordpipePath = "C:\Program Files\DataMystic\WordPipe\WordPipe.exe"

$action = New-ScheduledTaskAction `
    -Execute $wordpipePath `
    -Argument '/f:"D:\Documents\Shared" /wordlist:"C:\WordLists\server_migration.txt" /subfolders /silent /log:"C:\Logs\wordpipe_migration.log"' `
    -WorkingDirectory "C:\Program Files\DataMystic\WordPipe"

# Trigger: Run every Sunday at 1:00 AM
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Sunday -At "01:00"

$settings = New-ScheduledTaskSettingsSet `
    -AllowStartIfOnBatteries `
    -StartWhenAvailable `
    -ExecutionTimeLimit (New-TimeSpan -Hours 4)

Register-ScheduledTask `
    -TaskName $taskName `
    -Action $action `
    -Trigger $trigger `
    -Settings $settings `
    -User "SYSTEM" `
    -RunLevel Highest `
    -Description "Weekly: Update document hyperlinks after server migration"

Write-Host "Task '$taskName' created."

ExcelPipe Scheduled Task

Schedule ExcelPipe to update data source connections, fix hyperlinks, or perform batch find-and-replace in Excel files.

Command-Line Arguments

Argument Description
/f:"path" Input file or folder path
/s:"find" Search text
/r:"replace" Replacement text
/wordlist:"path" Path to a word list file
/subfolders Include subfolders
/log:"path" Log file path
/silent Suppress UI dialogs
# Schedule ExcelPipe for nightly data source updates
$taskName = "DataMystic - ExcelPipe Data Source Update"
$excelpipePath = "C:\Program Files\DataMystic\ExcelPipe\ExcelPipe.exe"

$action = New-ScheduledTaskAction `
    -Execute $excelpipePath `
    -Argument '/f:"D:\Reports\Excel" /s:"oldserver.corp.local" /r:"newserver.corp.local" /subfolders /silent /log:"C:\Logs\excelpipe_datasource.log"' `
    -WorkingDirectory "C:\Program Files\DataMystic\ExcelPipe"

# Trigger: Run weeknights at 11:00 PM
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday,Tuesday,Wednesday,Thursday,Friday -At "23:00"

$settings = New-ScheduledTaskSettingsSet `
    -AllowStartIfOnBatteries `
    -StartWhenAvailable `
    -ExecutionTimeLimit (New-TimeSpan -Hours 3)

Register-ScheduledTask `
    -TaskName $taskName `
    -Action $action `
    -Trigger $trigger `
    -Settings $settings `
    -User "SYSTEM" `
    -RunLevel Highest `
    -Description "Weeknight: Update Excel data source connections after server migration"

Write-Host "Task '$taskName' created."

PowerPointPipe Scheduled Task

Schedule PowerPointPipe for batch updates to presentation files — fixing links, updating branding, or replacing text across hundreds of decks.

Command-Line Arguments

Argument Description
/f:"path" Input file or folder path
/s:"find" Search text
/r:"replace" Replacement text
/wordlist:"path" Path to a word list file
/subfolders Include subfolders
/log:"path" Log file path
/silent Suppress UI dialogs
# Schedule PowerPointPipe for corporate rebranding updates
$taskName = "DataMystic - PowerPointPipe Rebrand"
$pptpipePath = "C:\Program Files\DataMystic\PowerPointPipe\PowerPointPipe.exe"

$action = New-ScheduledTaskAction `
    -Execute $pptpipePath `
    -Argument '/f:"D:\Presentations\Corporate" /wordlist:"C:\WordLists\rebrand_2025.txt" /subfolders /silent /log:"C:\Logs\pptpipe_rebrand.log"' `
    -WorkingDirectory "C:\Program Files\DataMystic\PowerPointPipe"

# Trigger: Run once on a specific date (one-time migration task)
$trigger = New-ScheduledTaskTrigger -Once -At "2025-07-01 03:00"

$settings = New-ScheduledTaskSettingsSet `
    -AllowStartIfOnBatteries `
    -StartWhenAvailable `
    -ExecutionTimeLimit (New-TimeSpan -Hours 6) `
    -DeleteExpiredTaskAfter (New-TimeSpan -Days 30)

Register-ScheduledTask `
    -TaskName $taskName `
    -Action $action `
    -Trigger $trigger `
    -Settings $settings `
    -User "SYSTEM" `
    -RunLevel Highest `
    -Description "One-time: Corporate rebranding text updates across all presentations"

Write-Host "Task '$taskName' created."

FileWatcher as a Service

FileWatcher can run as a Windows Service for continuous, real-time folder monitoring. This is often preferable to Task Scheduler for file-triggered automation because it responds instantly to new files without polling delays.

Install FileWatcher as a Windows Service

# Install FileWatcher as a Windows Service
# Run as Administrator

$fwPath = "C:\Program Files\DataMystic\FileWatcher\FileWatcher.exe"

# Install the service
& $fwPath /install

# Configure the service to start automatically
Set-Service -Name "FileWatcher" -StartupType Automatic

# Start the service
Start-Service -Name "FileWatcher"

# Verify it's running
Get-Service -Name "FileWatcher" | Format-Table Name, Status, StartType

Write-Host "FileWatcher service installed and running."
Write-Host "Configure watched folders via the FileWatcher configuration file."

Schedule FileWatcher Restart (Health Check)

Even with FileWatcher running as a service, you may want a scheduled task to verify it is running and restart it if necessary:

# Schedule a FileWatcher health check task
$taskName = "DataMystic - FileWatcher Health Check"

# Create a script that checks and restarts if needed
$scriptContent = @'
# FileWatcher health check script
$service = Get-Service -Name "FileWatcher" -ErrorAction SilentlyContinue

if (-not $service) {
    Write-EventLog -LogName Application -Source "DataMystic" -EventId 1001 -EntryType Error -Message "FileWatcher service not found"
    exit 1
}

if ($service.Status -ne 'Running') {
    Write-EventLog -LogName Application -Source "DataMystic" -EventId 1002 -EntryType Warning -Message "FileWatcher not running. Restarting..."
    Start-Service -Name "FileWatcher"
    Start-Sleep -Seconds 5

    $service = Get-Service -Name "FileWatcher"
    if ($service.Status -eq 'Running') {
        Write-EventLog -LogName Application -Source "DataMystic" -EventId 1003 -EntryType Information -Message "FileWatcher restarted successfully"
    } else {
        Write-EventLog -LogName Application -Source "DataMystic" -EventId 1004 -EntryType Error -Message "FileWatcher failed to restart"
        exit 1
    }
} else {
    # Service is running normally
    exit 0
}
'@

$scriptPath = "C:\Scripts\filewatcher_healthcheck.ps1"
$scriptContent | Out-File -FilePath $scriptPath -Encoding UTF8

$action = New-ScheduledTaskAction `
    -Execute "powershell.exe" `
    -Argument "-ExecutionPolicy Bypass -File `"$scriptPath`""

# Run every 15 minutes
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 15)

$settings = New-ScheduledTaskSettingsSet `
    -AllowStartIfOnBatteries `
    -DontStopIfGoingOnBatteries `
    -StartWhenAvailable

Register-ScheduledTask `
    -TaskName $taskName `
    -Action $action `
    -Trigger $trigger `
    -Settings $settings `
    -User "SYSTEM" `
    -RunLevel Highest `
    -Description "Every 15 min: Verify FileWatcher service is running, restart if needed"

Write-Host "Health check task created."

Trigger Types and Patterns

Windows Task Scheduler supports multiple trigger types. Choose the pattern that fits your automation needs:

# --- Common Trigger Patterns ---

# Daily at a specific time
$daily = New-ScheduledTaskTrigger -Daily -At "02:00"

# Weekdays only at 6:30 PM
$weekdays = New-ScheduledTaskTrigger -Weekly `
    -DaysOfWeek Monday,Tuesday,Wednesday,Thursday,Friday `
    -At "18:30"

# Every 4 hours during business hours (repeat within a day)
$repeating = New-ScheduledTaskTrigger -Once -At "06:00" `
    -RepetitionInterval (New-TimeSpan -Hours 4) `
    -RepetitionDuration (New-TimeSpan -Hours 16)

# On system startup (useful for service-like behavior)
$startup = New-ScheduledTaskTrigger -AtStartup

# At user logon
$logon = New-ScheduledTaskTrigger -AtLogOn

# Monthly on the 1st and 15th
$monthly = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Monday -WeeksInterval 2 -At "01:00"

# --- Combining Multiple Triggers ---
# A single task can have multiple triggers
Register-ScheduledTask `
    -TaskName "DataMystic - Multi-Trigger ETL" `
    -Action $action `
    -Trigger @($daily, $startup) `
    -Settings $settings `
    -User "SYSTEM"

Event-Based Triggers

Trigger TextPipe when a specific Windows Event occurs (e.g., file share mount, network connection restored):

# Trigger TextPipe when a specific event is logged
# Example: Run when Event ID 4624 (successful logon) occurs in Security log

$CIMTriggerClass = Get-CimClass -ClassName MSFT_TaskEventTrigger -Namespace Root/Microsoft/Windows/TaskScheduler

$trigger = New-CimInstance -CimClass $CIMTriggerClass -ClientOnly
$trigger.Subscription = @"
<QueryList>
  <Query Id="0" Path="Application">
    <Select Path="Application">*[System[Provider[@Name='DataMystic'] and EventID=2000]]</Select>
  </Query>
</QueryList>
"@
$trigger.Enabled = $true

# This triggers TextPipe when a custom event is logged
# Useful for triggering transformations after another process completes

Logging and Monitoring

Configure logging to track scheduled task execution and diagnose failures.

# Wrapper script for scheduled tasks with comprehensive logging
# Save as: C:\Scripts\run_textpipe_logged.ps1

param(
    [Parameter(Mandatory)]
    [string]$FilterPath,

    [Parameter(Mandatory)]
    [string]$InputFolder,

    [Parameter(Mandatory)]
    [string]$OutputFolder,

    [string]$FileMask = "*.csv",
    [string]$LogDir = "C:\Logs\TextPipe"
)

# Create timestamped log file
$timestamp = Get-Date -Format "yyyyMMdd_HHmmss"
$logFile = Join-Path $LogDir "textpipe_$timestamp.log"
New-Item -ItemType Directory -Path $LogDir -Force | Out-Null

function Write-Log {
    param([string]$Message, [string]$Level = "INFO")
    $entry = "$(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') [$Level] $Message"
    $entry | Add-Content $logFile
    Write-Host $entry
}

Write-Log "=== TextPipe Scheduled Execution Start ==="
Write-Log "Filter: $FilterPath"
Write-Log "Input:  $InputFolder"
Write-Log "Output: $OutputFolder"
Write-Log "Mask:   $FileMask"

$textpipePath = "C:\Program Files\DataMystic\TextPipe\TextPipe.exe"
$exitCode = 0

try {
    # Verify prerequisites
    if (-not (Test-Path $textpipePath)) {
        throw "TextPipe not found at: $textpipePath"
    }
    if (-not (Test-Path $FilterPath)) {
        throw "Filter file not found: $FilterPath"
    }
    if (-not (Test-Path $InputFolder)) {
        throw "Input folder not found: $InputFolder"
    }

    # Count input files
    $inputFiles = Get-ChildItem $InputFolder -Filter $FileMask -Recurse
    Write-Log "Input files found: $($inputFiles.Count)"

    if ($inputFiles.Count -eq 0) {
        Write-Log "No input files to process. Exiting." "WARN"
        exit 0
    }

    # Ensure output folder exists
    New-Item -ItemType Directory -Path $OutputFolder -Force | Out-Null

    # Execute TextPipe
    $tpLogFile = Join-Path $LogDir "textpipe_internal_$timestamp.log"
    $args = "/filter:`"$FilterPath`" /inputfolder:`"$InputFolder`" /outputfolder:`"$OutputFolder`" /mask:`"$FileMask`" /recurse /silent /overwrite /log:`"$tpLogFile`""

    Write-Log "Executing: TextPipe.exe $args"
    $process = Start-Process -FilePath $textpipePath -ArgumentList $args -Wait -PassThru -NoNewWindow
    $exitCode = $process.ExitCode

    Write-Log "TextPipe exit code: $exitCode"

    # Verify output
    $outputFiles = Get-ChildItem $OutputFolder -Filter $FileMask -Recurse
    Write-Log "Output files created: $($outputFiles.Count)"

    if ($outputFiles.Count -eq 0) {
        Write-Log "WARNING: No output files were created!" "ERROR"
        $exitCode = 1
    }

    # Log file sizes
    $totalSize = ($outputFiles | Measure-Object -Property Length -Sum).Sum
    Write-Log "Total output size: $([math]::Round($totalSize / 1MB, 2)) MB"
}
catch {
    Write-Log "FATAL ERROR: $_" "ERROR"
    $exitCode = 2
}
finally {
    Write-Log "=== TextPipe Scheduled Execution End (Exit: $exitCode) ==="

    # Clean up old log files (keep 30 days)
    Get-ChildItem $LogDir -Filter "textpipe_*.log" |
        Where-Object { $_.LastWriteTime -lt (Get-Date).AddDays(-30) } |
        Remove-Item -Force

    exit $exitCode
}

Register the Wrapper Script as a Scheduled Task

# Register the logging wrapper as a scheduled task
$taskName = "DataMystic - TextPipe Nightly ETL (Logged)"

$action = New-ScheduledTaskAction `
    -Execute "powershell.exe" `
    -Argument '-ExecutionPolicy Bypass -File "C:\Scripts\run_textpipe_logged.ps1" -FilterPath "C:\Filters\nightly_etl.fll" -InputFolder "C:\Data\Incoming" -OutputFolder "C:\Data\Processed" -FileMask "*.csv"'

$trigger = New-ScheduledTaskTrigger -Daily -At "02:00"

$settings = New-ScheduledTaskSettingsSet `
    -AllowStartIfOnBatteries `
    -StartWhenAvailable `
    -RestartCount 2 `
    -RestartInterval (New-TimeSpan -Minutes 10) `
    -ExecutionTimeLimit (New-TimeSpan -Hours 2)

Register-ScheduledTask `
    -TaskName $taskName `
    -Action $action `
    -Trigger $trigger `
    -Settings $settings `
    -User "SYSTEM" `
    -RunLevel Highest `
    -Description "Nightly ETL with comprehensive logging and output verification"

Write-Host "Logged task '$taskName' created."

Next Steps