You can use Windows Task Scheduler to run the Plex backup script (PlexBackup.ps1) on a schedule.
Enter Task Scheduler in the Windows Search box and launch Task Scheduler.
In Task Scheduler's Actions panel, click Create Task.... You can do this in a number of ways, but in the end, your task should look similar to this one:
You can set the task properties in the new task creation wizard or modify after creating the task (double-click the task to open its properties for editing).
When setting up the Plex backup scheduled task, please make sure that it runs:
- only when use is logged on
- as the same account as you Plex Media Server process
- with highest privileges
The task action (in the Actions properties) must be:
PowerShell.exe
The program/script arguments of the task action would be similar to:
-WindowStyle Hidden -ExecutionPolicy Bypass "C:\PathToYourBackupScript\PlexBackup.ps1"
The following screenshots are just for your reference. You may want to adjust them to fit your needs.
The program/script arguments of the task action would be something like:
-WindowStyle Hidden -ExecutionPolicy Bypass "C:\PathToYourBackupScript\PlexBackup.ps1"
When setting up the Plex backup schedule, make sure the backup job does not run at the same time as Plex Media Server's (PMS') scheduled tasks (check Settings - Scheduled Tasks under your PMS instance).
There is an issue with the Windows Task Scheduler that for some reason may prevent Plex Media Server (PMS) from connecting to the remote shares (such as NAS shares) hosting media files or force connection under a wrong security context. The problem does not occur when running the backup interactively, only when it runs as a scheduled task. I am still not sure what the root cause is, but to address the problem, try using the following command-line options:
Logoff
: logs off all other logged in users (I noticed that it normally happens when other users with different privileges are logged in)Reboot
: reboot the computer after successful operation (if theLogoff
option does not help, try rebooting the computer; notice that this may prompt user to accept the restart and keep waiting until the user responds)ForceReboot
: reboot the computer without the prompt (if all else fails try this option)
Keep in mind that unless you run PMS as a service, it would require the user to log on (otherwise, PMS will not start). You can set up your system to auto log on as the PMS user account, but if you do, make sure that you lock Windows after logging on. Here is an article explaining how this can be done: