Skip to content

Latest commit

 

History

History
79 lines (42 loc) · 3.97 KB

SCHEDULED PLEX BACKUP.md

File metadata and controls

79 lines (42 loc) · 3.97 KB

Scheduled Plex backup

You can use Windows Task Scheduler to run the Plex backup script (PlexBackup.ps1) on a schedule.

Launch Windows Task Scheduler

Enter Task Scheduler in the Windows Search box and launch Task Scheduler.

Create a new task

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:

Task Scheduler

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.

General

General

Triggers

Triggers

Trigger properties

Trigger properties

Actions

Actions

Action properties

Action properties

The program/script arguments of the task action would be something like:

-WindowStyle Hidden -ExecutionPolicy Bypass "C:\PathToYourBackupScript\PlexBackup.ps1"

Conditions

Conditions

Settings

Settings

Tip

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).

Issues

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 the Logoff 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:

Automatically log in to Windows and then lock straight away