<#
.SYNOPSIS
  Register Windows Task Scheduler job for live DBAOps collection every 15 minutes.
.EXAMPLE
  .\scripts\schedule-collector.ps1
#>
$repo = Split-Path $PSScriptRoot -Parent
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument "-NoProfile -ExecutionPolicy Bypass -File `"$repo\scripts\run-full-collection.ps1`""
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddMinutes(1) -RepetitionInterval (New-TimeSpan -Minutes 15) -RepetitionDuration ([TimeSpan]::MaxValue)
Register-ScheduledTask -TaskName 'DBAOps-Sovereign-Collector' -Action $action -Trigger $trigger -Description 'Live fleet collection for DBAOps Sovereign' -Force
Write-Host 'Scheduled: DBAOps-Sovereign-Collector every 15 minutes' -ForegroundColor Green
