Skip to main content
This documentation is for Passwork version 5.0, no longer supported.

See documentation for version 7.0.
Version: 5.0

Configuring Windows Task Scheduler

Task Scheduler is an inbuilt utility that allows you to automatically run programs or scripts on a set schedule or when specified conditions occur.

In Passwork starting from version 5.1.0 there is a special script that synchronises users:

C:\intepub\wwwroot\passwork\app\tools\run-scheduled-tasks.php

It can be run manually or set up to run using Windows Job Scheduler.

We recommend that you first test the script in manual mode. To do this, run the following cmdlet in PowerShell:

php.exe C:\inetpub\wwwroot\passwork\app\tools\run-scheduled-tasks.php

If errors occur, they will be written to a log file. After the test, make sure that there are no errors in the following file:

C:\inetpub\wwwroot\passwork\app\logs\run-command.log
info

Make sure that the user on whose behalf the script is executed has write permissions

Configuring Task Scheduler

Run PowerShell as Administrator:

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

Create a task in the Scheduler to run the script:

Register-ScheduledTask `
-Action (New-ScheduledTaskAction -Execute "$env:ProgramFiles\php8.2\php.exe" -Argument "-f $env:SystemDrive\inetpub\wwwroot\passwork\app\tools\run-scheduled-tasks.php") `
-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 "username" -Password "password" -Force
danger

The following parameters should include details of the user on whose behalf the task will run:

  • -User — Username;
  • -Password — User's password.

We recommend using the local Administrator account to avoid any problems with permissions.

Testing and troubleshooting

Open Passwork under an administrator's account and open the Background tasks page.

If you see a message that the scheduler is not configured, check for errors in the log file at:

C:\inetpub\wwwroot\passwork\app\logs\run-command.log

Forward it to our technical support if you need help with troubleshooting.

Task Scheduler logs

You can view the scheduler log in the Event Viewer at Application and Services logsMicrosoftWindowsTaskSchedulerOperational:

Searching password by browser extension