PMS as a service

This post will always contain the latest version of the Plex service wrapper.
This is not official or affiliated with Plex in any way and was originally made for personal use. Treat it as such and please don’t bug the Plex devs about it. (bug them about Plex not running as a service natively by all means :P) feel free to post your questions here and I will do my best to help.

If you are having problems, the first question will be whether it runs ok when not being run as a service. Please ensure you can get Plex up and running fine on it’s own.

Please read all of this post, there is lots of information covering the most common problems (Mapped drives, different user accounts etc)

The service application was created to enable Plex Media Server to operate as a service in windows.
It has been reported to work on the following OS’s and requires .net framework 4 is installed:

  • Windows Server 2003
  • Windows Home Server V1
  • Windows Server 2008 R2
  • Windows Home Server 2011
  • Windows Server 2012 R2
  • Windows Server 2012 Essentials
  • Windows XP
  • Windows 7
  • Windows 8
  • Windows 8.1
  • Windows 10
  • Windows 11

Latest version is 1.2.3. It is open source and up on the github if you want to build it yourself: github.com/cjmurph/PmsService

For Plex Media Server 1.32.0 and above, PMSService 1.2.2 or later should be used.
For versions after 1.32, the “Open Plex” in the Plex Service Tray app takes same action as that in the Plex Media Server tray Open Plex button referenced in this forum topic New Claiming Requirement for Windows - Plex Media Server / Desktops & Laptops - Plex Forum

There is a built copy available under releases on the github here: github.com/cjmurph/PmsService/releases

To update Plex Media Server:

  1. Stop the plex using the service task bar application
  2. Run the plex installer to do the upgrade as usual.
  3. When the installer is complete, start Plex using the service task bar application.

UPDATE: From v1.2.3 remotely updating via the plex web interface works as expected

[WARNING] Read below if you intend to change the service account
If you change the service account type or the service user account from your current configuration, your application data (and therefore your library) will not be available when you start Plex.
If you want to run the service under a different account, Then you should first move your Plex application data folder to a common folder (Personally I have mine on a second drive of my server “D:\Plex”).
If the application data is left under the previous account’s folder, then the new account will not have permission to get to it.
Once you have the application data in a common place, edit the Windows registry according to this guide: [HowTo] An extended guide on how to move the Plex data folder on Windows
You must be logged in to the Windows user account, under which you are going to run the server, while doing this! (Actually it is also possible while logged in as Administrator, but then you’ll have to determine the Windows user ID number of the intended user account, to be able to edit the right part of the registry.)

When asked for your credentials during install make sure you fully qualify the user name.
If you are on a domain, the username is entered as domain\username.
If you aren’t on a domain, the domain is the computer itself so replace the domain name with the computer name eg. (mycomputersname\username OR .\username).

The install includes a tray application to start and stop Plex, view logs for the service and open the Plex web manager.

There is a large amount of extra information in this thread running-pms-as-a-service-in-whs which is where this application was born from.

Media location:
When Plex runs as a service, there is no user session created. Plex will run in a non-interactive session (session 0). This means that any drive mappings you have created will not be available.
If your media is located on a network device, Plex sections must be set up to look at a UNC path NOT a mapped drive.

Mapped drives – EXPERIMENTAL
From version 1.1.3 this service supports user defined drive mappings. Configure the map in settings and it will be made available before PMS is started.
You should ensure the user account the service is run under has access to the network share.
This is experimental at the moment. if you have issues, please review your logs and report back here.

Auxiliary applications:
Applications you want to have running with Plex. An example is Plexconnect, the python script for using plex with an apple TV.
I’ve added this after a request from a user to wrap Plexconnect the same way I did Plex, I figured it would work OK in the same service. I don’t use Plexconnect personally but I tested this new system with several other applications and they all ran up fine.

To add an auxiliary application, using the task bar icon, go to settings, you will get a new window. click the add button to add a new application, and the remove button to remove the currently selected one.
Name is a user friendly name for the application, file is the file to execute and arguments is any command line arguments you want to add. If you specify a URL, a menu item will be made available directly from the tray application to navigate to that address.

Save the settings and the next time the service is started the application you specified will start too. Check the logs (again through the task bar icon) to see how you got on.

I would suggest making sure that the application runs as expected in a normal user session BEFORE attempting to run it as an auxiliary application.

If you are installing Plex for the first time, I’d still recommend moving the application data folder, the user folder isn’t the best spot.

If you like the software, buy me a beer :slight_smile:

Enjoy,

cjmurph.

18 Likes
Plex Media Server as Startup Task in 2012R2
Remote devices can't connect to Plex server when media server computer is locked
Startup
Plex ignores host OS account permissions somehow
PMS on Windows 11
An insecure media server has been found on your network
Forum Updates causing broken
Plex cannot create library of >500,000 music files (>2TB)
Plex DVR, Trying to watch Live TV but get error "Unable to tune channel (no parts)"
Official recommended way to run Plex Server as a Server (service) on Windows 11
All media server v.1.18.x updates cause server unreachable/unavailable after update
Run plex server automatically
UNC Path not working following update to 1.32.0.6918
How do I configure Plex Media Server to run as a Windows Service?
Sever crashing daily windows 10
Unable to Access Win Plex Server Unless User Remains Logged On
Should I and how do you upgrade from 32bit to 64bit PMS
DVR no longer operational, cannot setup new DVR
Help Needed : Can't add NAS Folders to library
Option to install plex as a service instead on windows
Server unavailable/offline when windows user logged out
Where is the Plex Media "Server" Supported autostart program/function/Service?
Where has my Server Gone
Plex server not available when not logged into Windows accout
Constant reinstall because plex can't detect network drives
Download fail
Plex Media Server doesn't start up unless someone logs into the server console
Plex Media Server Not Starting After Computer Restart
Will this work? Run PMS on Windows 10 using local account and Task Scheduler or SCM
Plex Roku App version 6.7.3 broke - Plex app crashes
DVR no longer operational, cannot setup new DVR
Last 4 updates from Plex have failed
Duplicate / multiple servers keep appearing
Plex no longer sees my Hauppauge WinTV-quadHD tuner, "Add Device" scans forever
Plex Media Server unavailable after switching from another Windows 10 account
PMS can't find hdhomerun
How can I share Plex configuration & metadata between multiple Windows users on the same machine?
Newbie here With Tons Of Questions
DVR disappeared and won't readd
Start Plex server without logging in
External hard drive not showing in Browse for Media Folder
Lost LiveTV and DVR access
Apply commercial skipping to existing recordings?
Plex doesn't work if my computer restarts but I'm not around to login with facial recognition
PMS stops running on Win11 NUC
Secure Connections not working - running on 1.14.0.5468
New Plex server after reboot
Plex doesn't start on reboot
Help! PMS is down multiple times per day!
Plex keeps crashing/closing
Having plex media server starts at login screen
Claiming Server?
Locked out of my server, get "401 unavailable" when I try to "open plex..."
After move to new PC - access don't seem right
Getting Plex Media Server to run when windows starts
After windows plex server updates, the Plex Media Server.exe dissapears
Windows with Plex not HW transcoding correctly
Windows 11 Plex as System Crashes
Windows with different users need different plex server installs?
Version 1.32.5.7210 - Windows
Plex SERVER Auto-start - How?
Live TV HD Appears Pixelated Part II: x86-Only
Using RDP with Plex and DLNA enabled
The Plex Update Service service terminated unexpectedly
Plex Server on Windows refuses to start after years
Plex Media Server will not run on WHS 2011
Need Help With Adding Local Network Libraries
PlexServer on Windows not Starting Until User Logs On
Plex Update Service deletes "LocalAppDataPath" registry key
Many shows deleted by Plex at 2:00 AM every night
PMS 1.14.1.5488 Crashing frequently on Windows
How do I configure Plex Media Server to run as a Windows Service?
Plex Install on a Windows Server 2019
[Windows 10 Update KB4338819 issue] Conversion Failed. The transcoder exited due to an error
An oddity running PMS with service account vs my Plex account
Plex keeps starting itself at login even though I have that disabled
Can I set the plex server as a windows service?
Plex library not loading on web or app until I log onto Windows with remote desktop
Plex Auto Launch Issues on Startup/Restart
Plex shuts down when windows 10 locks/logs off
Windows Server 2019 plex doesn’t use full CPU power for transcoding
Odd plex wont start issue
Anyone using AlwaysUp to run Plex as a service? On restart, the application path has recently starting to reset as TEMP instead of the actual user
Installation of the 64 bit version on the 32 bit
Server Unavailable
PMS on Windows Server spawning tons of "Plex Transcoder.exe" processes causing Windows to crash

Issues:

Webkit based channels will not work while Plex is running as a service.

Update via web interface is not a good idea. The service wrapper will attempt to keep Plex alive and restart it during the update. Stick with the traditional method for now.

Hardware acceleration is not available to windows services as they are isolated in session 0 and have no access to the hardware

Troubleshooting:

Q. My media disappears when I run as a service. It works fine when run normally.
A. Most likely you have your Plex media sections configured via mapped drives. The drive mappings are not available when run as a service. Change to UNC paths or try the new drive mapping feature available from version 1.1.3

Thank you cjmurph for this excellent package which I have now been running for some time on Windows 7 and it works wonderfully

It is necessary to ensure that Plex Media Server does not automatically start to run on start because the Service will make sure that happens. If Plex Media Service is left to auto start, then you would end up with 2 instances running. The Plex Media Server Service install program removes the Windows Registry that auto starts Plex Media Server, however this does not help the case when a user wants to run Plex Media Server in a different windows account from the one used for installing it.

 

So for anybody that runs Plex Media Server in a different Windows User Account from the one used for Installing Plex Media Server, you will need to make sure the Plex Media Server does not start automatically on Logging Into the install user account and this can be done in one of ways:

 

1, Let is start in the wrong user account and then uncheck the Auto Start option in the Plex Media Server System Tray icon options and Exit Plex Media Server,

 

You will need to restart the Plex Media Server Server Service as well for the normal account as having two instances of Pllex Media Server on the same computer concurrently leads to indeterminate results for the tcp ports the server listens on.

 

or

 

2. Do not let it start in the wrong account and make sure you un-tick Launch at the end of Plex Media Server Upgrade or Install or Repair and

in the install account where you do not want Plex Media Server to start automatically, delete the following Registry key with Regedit:

 

HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run\Plex Media Server

 

I personally use option 2. I use the Plex Media Server Service Tray icon in the Admin Account. In fact I never sign in to the Plex account that runs the service.

Note: When using the 64-bit Windows build, the install program remembers the previous setting of auto-launch on login - so it ought to only be necessary to do this once and it would be remembered after that

Hmm interesting, I've always used srvany.exe with plex to make it run as a service..

Will try this over the weekend :)

Thanks for this - working great on Server 2012 R2.

Working Brilliantly on WHS2011. Thanks again...

Thank you.   As an IT professional, this has saved Plex for use in my network.  I've been using TVersity for quite some time but it has it's own limitations.  The layout and thought that has been put into Plex is great, but being able to run as a service is a must for my environment.

FYI running it on a Server 2008R2 VM under a clustered Hyper-V environment.

To note again from above, when you install this, you must use the same credentials you used to install the Plex server otherwise it will not function properly.

Thanks again for your work.

Thank you cjmurph, works also on Windows Server 2012 Essentials (no R2)

so i had my whs11 server running brilliantly until it restarted last night and now my plex doesnt run unless i am logged in (cant remember exactly how i set it up originally but it was working)

anyways, in an attempt to rectify my issues i downloaded your lovely plex service thingymajig.

i install and add my credentials, i get the little tray icon and all that.

i log off and plex still isnt working.

log on and it works, so i click the tray icon (for your program) and i see i need to start the service.

i click start service but get an unhandled error. 

any ideas?

so i had my whs11 server running brilliantly until it restarted last night and now my plex doesnt run unless i am logged in (cant remember exactly how i set it up originally but it was working)

anyways, in an attempt to rectify my issues i downloaded your lovely plex service thingymajig.

i install and add my credentials, i get the little tray icon and all that.

i log off and plex still isnt working.

log on and it works, so i click the tray icon (for your program) and i see i need to start the service.

i click start service but get an unhandled error. 

any ideas?

Windows Event Log will show the exact error. 

I did have permissions issue initially on ProgramData folder for the log file access - path/folder might be different on WHS.

Suggest looking in the System and Application Event logs for Plex related entries at time of starting the service

Also check syntax for credentials    domain\username or .\username 

so i had my whs11 server running brilliantly until it restarted last night and now my plex doesnt run unless i am logged in (cant remember exactly how i set it up originally but it was working)

anyways, in an attempt to rectify my issues i downloaded your lovely plex service thingymajig.

i install and add my credentials, i get the little tray icon and all that.

i log off and plex still isnt working.

log on and it works, so i click the tray icon (for your program) and i see i need to start the service.

i click start service but get an unhandled error.

any ideas?


Hi,

First, to be on the safe side, ensure Plex isn't running when you try and start the service. It should work, but if the service account and the current logged on user account are different, you may get issues.

Second, make sure the Plex user (the user account you used when installing the service) has write permission on the programdata folder.

If both the above are ok, please post the service log, accessible from the tray icon.

Also, thanks everyone for updates on the os' you have tested on. I'll update the first post.

Windows Event Log will show the exact error. 

I did have permissions issue initially on ProgramData folder for the log file access - path/folder might be different on WHS.

Suggest looking in the System and Application Event logs for Plex related entries at time of starting the service

Also check syntax for credentials    domain\username or .\username 

thanks.

:ph34r: restarted and it works now.

shoulda tried that first really after all "it is windows"

thanks.

:ph34r: restarted and it works now.

shoulda tried that first really after all "it is windows"

Strange though that it was an exception that was generated

Would still be worth checking:

- the windows event logs,

- task manager with 'show processes for all users' to ensure that only one instance of Plex Media Server.exe running and also

  that there is a process for PlexMediaServer-Service.exe

- the Plex Media Server Service log file (via system tray service icon ) 

I'm getting a .NET Framework error saying "unhandled exception". In the details is mentions somehting about JIT. I'm running  the newest .NET Framework 4.5.1. I also see in the log files it says "Plex Media Server does not appear to be installed!".

I'm getting a .NET Framework error saying "unhandled exception". In the details is mentions somehting about JIT. I'm running the newest .NET Framework 4.5.1. I also see in the log files it says "Plex Media Server does not appear to be installed!".


So I guess the obvious has to be asked... Is Plex Media server installed? You wouldn't be the first person to install the client by mistake.

So I guess the obvious has to be asked... Is Plex Media server installed? You wouldn't be the first person to install the client by mistake.


It's not installed but that's because Plex isn't compatible with server 2008 r2. When I tried installing it said it wasn't compatible. I figured the PMS as a service was a way around it

Plex isn't compatible with server 2008 r2. When I tried installing it said it wasn't compatible. 

Google search as this below shows people are using Plex Media Server on Windows Server 2008 R2

site:forums.plex.tv "server 2008 r2"

Maybe you have a corrupt incomplete download for Plex Media Server (versions are 0.9.8.18 general or 0.9.9.0 PlexPASS)

We had lots of such examples. It should be circa 60.1Mb in size and file properties should show a Digital Signatures tab with certificate from Plex Inc

It's not installed but that's because Plex isn't compatible with server 2008 r2. When I tried installing it said it wasn't compatible. I figured the PMS as a service was a way around it

It is compatible. That's what I use. I'd follow sa2000's suggestion and download it again.

A special thank you to cjmurph for making my setup with a home server work flawlessly, just the way I wanted it to!  I was finagling with a few other methods and nothing was working quite right, until this  :D My Rokus thank you as well making them my go to device for anything streaming.(at home)