You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
30 lines
1.0 KiB
[CmdletBinding()]
|
|
param()
|
|
|
|
$ErrorActionPreference = 'Stop'
|
|
$repositoryRoot = $PSScriptRoot
|
|
$syncScript = Join-Path $repositoryRoot 'sync-skills.ps1'
|
|
|
|
if (-not (Test-Path -LiteralPath $syncScript)) {
|
|
throw "Sync script not found at '$syncScript'."
|
|
}
|
|
|
|
$action = New-ScheduledTaskAction `
|
|
-Execute 'powershell.exe' `
|
|
-Argument "-NoProfile -NonInteractive -ExecutionPolicy Bypass -File `"$syncScript`""
|
|
$trigger = New-ScheduledTaskTrigger -Weekly -DaysOfWeek Sunday -At 10:00AM
|
|
$principal = New-ScheduledTaskPrincipal -UserId 'SYSTEM' -LogonType ServiceAccount -RunLevel Highest
|
|
$settings = New-ScheduledTaskSettingsSet `
|
|
-StartWhenAvailable `
|
|
-RunOnlyIfNetworkAvailable `
|
|
-MultipleInstances IgnoreNew `
|
|
-ExecutionTimeLimit (New-TimeSpan -Hours 1)
|
|
|
|
Register-ScheduledTask `
|
|
-TaskName 'PromptWorks Weekly Skill Sync' `
|
|
-Action $action `
|
|
-Trigger $trigger `
|
|
-Principal $principal `
|
|
-Settings $settings `
|
|
-Description 'Mirrors custom Microsoft Scout skills to PromptWorks.' `
|
|
-Force | Out-Null
|
|
|