Files
future-map-OPEN/scripts/future-map-insights-hub/install_daily_task.ps1
T

16 lines
557 B
PowerShell
Raw Normal View History

2026-08-12 13:28:40 -06:00
param(
[string]$TaskName = "FutureMap-InsightsHub-Daily",
[string]$StartTime = "06:00"
)
$ErrorActionPreference = "Stop"
$scriptDirectory = Split-Path -Parent $MyInvocation.MyCommand.Path
$runner = Join-Path $scriptDirectory "run_daily.ps1"
$taskCommand = 'powershell.exe -NoProfile -ExecutionPolicy Bypass -File "' + $runner + '"'
& schtasks.exe /Create /TN $TaskName /SC DAILY /ST $StartTime /TR $taskCommand /F
if ($LASTEXITCODE -ne 0) {
throw "Unable to create scheduled task $TaskName."
}
& schtasks.exe /Query /TN $TaskName /V /FO LIST