Hello,
I am trying to schedule a simple library scan via Task Scheduler, in order to avoid scanning every time my music library. In order to do this I have created a batch file which goes like this:
“Plex Media Scanner.exe” --scan --refresh --section 2
(repeated for each library I want to scan)
When triggered from Task scheduler (either by running the batch file or by passing directly “Plex Media Scanner.exe” and adding the relevant arguments to the Task Scheduler GUI, it’s like PMS cannot see the directory where the media is stored (mounted as Z:\ from the NAS).
If I manually run the same command from the prompt everything is fine.
I tried “run the task with the highest privileges” to no avail.
I attach the logs of the output from both the command line (OK) and from Task Scheduler for exactly the same command.
Any idea on what I am doing wrong?
As an alternative method, you could download curl for Windows and simply have it “touch” the URL and library in question as a way to force an update. It’s a simple one-line command.
If you’re intent on doing the scan via Task Scheduler, try using these settings for the Action:
Program/Script:
"C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Scanner.exe"
Add arguments (optional):
--scan --refresh --section 2
Start in (optional):
C:\Program Files (x86)\Plex\Plex Media Server\
Note the presence/absence of quotes in each, and do include the optional bits. I just tested this on my Windows 10 Pro (1909) server running PMS 1.18.3.2129 and it worked as expected. I created it as a Basic Task and left all other settings at their defaults. Have it run as your user, no extra privileges required.
@pshanew thank you for your suggestion, I had set up my task like yours. I added the "Start in " path to make it 100% identical but it did not make a difference.
I did one more test and I am now pretty sure the problem/bug lies in the fact thay my library is on a mapped drive.
I just created a TV folder on my server desktop and added it as a new TV show library to Plex.
It scans perfectly from task scheduler and episodes are added or removed. Basically local library on C: works and any other library which is on Z: doesn’t. I have no idea why since apparently the command is the same one, like if I triggered the scan from the PMS Web UI.
Yes I am aware of it. But it updates ALL libraries and my Music library is quite big and I never update it. It takes a while to do it.
I basically would like my TV libraries updated multiple times per day. “Run partial scan” also has never worked for me (maybe because media files are on a NAS).
Thank you, I was not aware of this. I am not extremely familiar with XML but I might try that route if I don’t manage to solve it with Task Scheduler.