windows/install-task.ps1
# Register a logon-start task. Run from an elevated PowerShell:
# powershell -ExecutionPolicy Bypass -File windows\install-task.ps1
$Root = Split-Path -Parent $PSScriptRoot
$Python = Join-Path $Root ".venv\Scripts\python.exe"
if (-not (Test-Path $Python)) {
$PyCmd = Get-Command py -ErrorAction SilentlyContinue
if ($PyCmd) { $Python = $PyCmd.Source } else { $Python = "python" }
}
$Action = New-ScheduledTaskAction -Execute $Python -Argument "-m bot" -WorkingDirectory $Root
$Trigger = New-ScheduledTaskTrigger -AtLogOn
Register-ScheduledTask -TaskName "open-autosecure" -Action $Action -Trigger $Trigger -Force