Harden logon stack startup

This commit is contained in:
Meta Vens 2026-05-12 12:48:49 +01:00
commit 0af88eec6e
3 changed files with 30 additions and 5 deletions

View file

@ -57,7 +57,9 @@ $taskNameValue = if (-not [string]::IsNullOrWhiteSpace($TaskName)) {
}
$action = New-ScheduledTaskAction -Execute "wscript.exe" -Argument "//B //nologo `"$hiddenLauncher`" -NoProfile -NonInteractive -WindowStyle Hidden -ExecutionPolicy Bypass -File `"$startScript`""
$action.WorkingDirectory = $repoRoot
$trigger = New-ScheduledTaskTrigger -AtLogOn -User "$env:USERDOMAIN\$env:USERNAME"
$trigger.Delay = "PT2M"
$settings = New-ScheduledTaskSettingsSet -StartWhenAvailable -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries -ExecutionTimeLimit (New-TimeSpan -Minutes 30)
$principal = New-ScheduledTaskPrincipal -UserId "$env:USERDOMAIN\$env:USERNAME" -LogonType Interactive -RunLevel Limited
$description = "Starts the VoidBot stack when this workstation user logs on so bot and worker do not stay dead after a reboot."