Files

17 lines
1.1 KiB
PowerShell
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Windows: регистрирует задачу в Планировщике (каждые 2 часа).
# Запуск: правой кнопкой -> "Выполнить с помощью PowerShell", ИЛИ в PowerShell:
# powershell -ExecutionPolicy Bypass -File .\scheduler\install-windows.ps1
$Root = (Resolve-Path "$PSScriptRoot\..").Path
$Bat = Join-Path $Root "scheduler\run.bat"
$Action = New-ScheduledTaskAction -Execute $Bat
$Trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) `
-RepetitionInterval (New-TimeSpan -Hours 2) -RepetitionDuration ([TimeSpan]::MaxValue)
$Settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -AllowStartIfOnBatteries `
-DontStopIfGoingOnBatteries
Register-ScheduledTask -TaskName "hhbump" -Action $Action -Trigger $Trigger `
-Settings $Settings -Description "hh resume booster" -Force
Write-Host "OK. Проверка: schtasks /Query /TN hhbump"
Write-Host "Разовый прогон: schtasks /Run /TN hhbump"
Write-Host "Удалить: schtasks /Delete /TN hhbump /F"
Write-Host "Логи: $Root\bump.log"