PMS as a service

Hi apologies if I have missed this in all the posts.

I have switched from running PMS on a Raspberrypi to Windows 10, I am in the process of getting a new backup script written to take a weekly backup of the metadata.

I have it mostly written, though I am struggling to get the zip file to create, I think this is because of the PMS as a service running and PMS itself running.

Can anyone share the commands to get PMS as a service to shutdown Plex, then itself and then restart the service and plex?

I tried
Get-Service -DisplayName “PlexService” | Stop-Service #Stop Plex
Stop-Process -processname “Plex*” -force

but this never worked. Ideally if I could get the command that is sent when you use the tray icon for PMS as a service to stop Plex and Start it up it would be ideal. I tried reading the code on GitHub without success.

Thanks

I posted an example of a batch file sometime back. I have noticed some obvious errors that must have crept in when the forums were migrated

Have a look and adapt it to suit your environment

What is the traditional method? I saw a post that implied we should download and run the installer for each new update. Is that correct? I have only ever updated via the web interface and there are quite a few updates.

For Plex Media Server updates when it is running as a Plex Service, the standard way is

  • download the installer from https://plex.tv/downloads
  • using the Plex Service Tray application, select ‘Stop Plex’
  • open windows task manager and check that all Plex Media Server processes are no longer running. There is an exception here: the updater service processes do remain and do not cause any harm. The other processes that remain are the Plex Service and service tray processes.
  • run the plex media server installer
  • if using different windows account for the install from the one the service logs on as, then see my post near the front of this thread for need to regedit to stop plex media server autostarting in the install windows account
  • at the end of the install do not click launch and just close the dialogue box
  • using the Plex Service tray app, click on ‘Start Plex’

Thanks for the detailed explanation. Given the fairly frequent updates, this is a bit of a cumbersome approach compared to the right click on the tray icon and select update plex method used currently. Appreciate the work done on this wrapper, but this is just another reason I really wish plex had an integrated run as service option.

It’s three steps… right click> stop, run the installer, and right click> start. If that’s too cumbersome, perhaps you should give up on modern day computing. :joy::joy:

Customcables067 - it’s not 3 steps. Look at the post two above and tell me which steps you can skip… hint: it’s none of them.

plex_seekaltroute_com - Your frustration is shared. Plex Media Server runs like an application from the Windows 95 days. There is absolutely no good reason it doesn’t run as a service on systems… and has the devs have said it is on their ‘roadmap’ since 2011.

Many of the steps you’d have to do regardless. Though I do wish Plex would run as a service in the first place, I hardly call it “cumbersome” - it’s not that difficult compared to some server maintenance you’d have to do on “real” server setups.

I have built an application that does what @sa2000 described with regards to upgrading Plex. You can find it here: https://github.com/TechieGuy12/PlexServerAutoUpdater.

can this be run on another machine on my network so i can stop/start my PMS on a different machine?

I can recommend this tool - my scenario:

  • Switch “Server version updates” to “Ask me”
  • Create a scheduled task for the updater with silent option enabled (for example every night).
  • If an update is available and you get notified by your desired client, just press download (SKIP THE INSTALL STEP)
  • The scheduled task does all the magic and applies the downloaded update to your server at the given point of your scheduled task.

*edit: Oh, I have seen that the latest version also provides automatic update downloading :slight_smile:

With the amount of glitches in any given Plex update - I can’t imagine why you’d want something that volatile auto-updating.

For me, I don’t run a complex Plex server and have been auto-updating mine for a year. I haven’t experienced any issues that prevent me from using Plex.

If I did, I would just roll back to a previous release.

To me, whether I update automatically or manually makes no difference. I would discover any issues regardless, and just rollback.

Then again, I don’t have a complex setup - just the members of my household so no real issue with auto-updating.

The Auto Updater tool can be run manually to perform the steps you would do anyway.

I must have some different version of Plex Server than you do, because when I try to roll back updates, it tells me my current version is newer than the version I’m trying to go back to, ie no rollback allowed. Hmm…

My rollback involves uninstalling the current version and installing a previous version. A pain, yes, but that is the only way I know about rolling back an update. Plex uses the Windows Installer service for installation, at that service doesn’t allow installing a previous version over a newer version.

That explains it, considering when I needed to do this, an installer error in Plex was preventing the uninstall itself. As a result, I’m extremely cautious about installing Plex updates and usually deploy them on a non-production server first prior to actual rollout. Tradeoffs of having a reliable system working for the family, I guess.

Most of issues with updates / uninstalls are probably down to 2 factors

  • being done when Plex Media Server is not shut down
  • use of tools such as ccCleaner and purging msi Package Cache files - files needed by Plex for any update or uninstall

One thing you can try when you get the error is to repair the current install. A repair should replace any missing files and registry keys that are missing and hopefully allow Plex to do the uninstall.

If I wanted to be able to programatically restart Plex using PMS as a Service, is that possible?

Anyone? :blush: