|
|
|
|
@ -19,11 +19,19 @@ $newPath = $existingPath + ";" + $destination
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# create a trigger that will run boundary at startup
|
|
|
|
|
$trigger = New-JobTrigger -AtStartup
|
|
|
|
|
$trigger = New-ScheduledTaskTrigger -AtStartup
|
|
|
|
|
$configPath = Join-path ${test_dir} -ChildPath "worker.hcl"
|
|
|
|
|
$jobLog = Join-path ${test_dir} -ChildPath "worker.out"
|
|
|
|
|
$command = "boundary server -config `"$configPath`" *> $jobLog"
|
|
|
|
|
Register-ScheduledJob boundary -ScriptBlock ([ScriptBlock]::Create($command)) -Trigger $trigger
|
|
|
|
|
|
|
|
|
|
New-Item -Path C:/Test/worker_task.ps1 -ItemType File -Value "boundary server -config $configPath *> $jobLog"
|
|
|
|
|
$action = New-ScheduledTaskAction -Execute 'powershell.exe' -Argument '-File C:/Test/worker_task.ps1'
|
|
|
|
|
Register-ScheduledTask -TaskName "boundary" -Action $action -Trigger $trigger -User "SYSTEM" -RunLevel Highest -Force
|
|
|
|
|
|
|
|
|
|
# set the task to have no execution time limit
|
|
|
|
|
$Task = Get-ScheduledTask -TaskName "boundary"
|
|
|
|
|
$Task.Settings.ExecutionTimeLimit = "PT0H" # zero hours
|
|
|
|
|
Set-ScheduledTask $Task
|
|
|
|
|
|
|
|
|
|
# Restart the computer to apply changes
|
|
|
|
|
# Needed for adding the computer to the domain from the user_data script
|
|
|
|
|
shutdown -r -t 10
|
|
|
|
|
|