Skip to main content
Version: 7.0

Windows Task Scheduler setup

The Task Scheduler is a built-in Windows utility that allows you to automatically run programs or scripts on a schedule or when specified conditions occur.

Passwork version 7 and above has a special script responsible for running background tasks:

php .\bin\console tasks:run

It can be run manually or configured to run on a schedule using the Windows Task Scheduler.

We recommend first checking the script operation in manual mode. To do this, perform the following actions in PowerShell:

cd C:\inetpub\wwwroot\passwork
php .\bin\console tasks:run
danger

If the error indicates that the php.exe utility, which runs the background task, is missing, then the directory containing PHP must be added to the PATH environment variable.

Check C:\inetpub\wwwroot\passwork\files\logs\tasks\ for errors.

tip

Make sure that the user under whose account the script runs has write permissions.

Task Scheduler setup

Open PowerShell as Administrator:

  • Right-click the Start icon in the lower-left corner of the screen;
  • Select Windows PowerShell (Administrator) from the context menu.

Create a task in the Task Scheduler to run the script:

Register-ScheduledTask `
-Action (New-ScheduledTaskAction -Execute "powershell.exe" -Argument "php .\bin\console tasks:run" -WorkingDirectory "C:\inetpub\wwwroot\passwork") `
-TaskName "passwork_task" -Settings (New-ScheduledTaskSettingsSet -AllowStartIfOnBatteries -StartWhenAvailable -Hidden -Priority 5) `
-Trigger (New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minute 1)) `
-RunLevel Highest -User "Administrator" -Password "password" -Force
danger

In the following parameters, specify the user credentials under which the background task will run:

  • -User — username;
  • -Password — user password.

To avoid permission issues when running background tasks, use a local administrator account.

Error checking and troubleshooting

Open Passwork and log in as Administrator/Owner, then go to the Background Tasks tab.

If configured correctly, a message will be displayed indicating that the scheduler is set up:

Searching password by browser extension

If you see a message that the scheduler is not configured, the execution errors are located in C:\inetpub\wwwroot\passwork\files\logs\tasks\