Menu

sharing my tech experience.

How to run Plex Media Server as a Windows Service

I previously wrote a blog about setting up Plex Media Server as a service in Windows. However, since then I have come across a new 3rd party service manager that is, in my opinion, easier to setup and use.

[See bottom of post for an update]

You first need to download the NSSM (Non-Sucking Service Manager) exe from here. The file will be a zip file. Extract this zip file to a folder on your desktop.

Inside the extracted folder, you will see a win32 and win64 folder. If you are using Windows 32-bit then you want the nssm.exe file from the win32 folder. If you are using Windows 64-bit, you will need the nssm.exe file from the win64 folder. Copy the correct nssm.exe file for your Windows OS to C:\Windows\system32

Now, run a command prompt as Administrator. The easiest way to do this is click on start and type cmd. When you see Command Prompt appear in the search results, press CTRL + SHIFT + ENTER or right click on Command Prompt and select “Run as Administrator”.

Display Name: Plex Media Server (or whatever you would like the service to display as)

Startup Type: Automatic

On the Logon tab, enter:

Choose “This account” radio button.

Enter the username under which Plex should run. If you are in a domain, enter your username as: DOMAIN\Username. If you are on a standalone workstation (most likely) then enter your username as: .\Username.

Enter your password.

In the Service Name box, enter the desired service name. I used “PMS” for a short name with the long name as the display name.

Click on Install Service.

If you don’t get any errors, then you should now be able to star the Plex Media Server like a normal service.

Be sure that you have disabled the Plex Media Server startup entry so that you don’t end up with two PMS instances when you log onto the PC. Keep in mind that when an application is run as a service like this, there will be no interaction with the user desktop. This means, if you want to install updates, you will have to stop the service and run the applicaiton manually to receive the update prompt. Alternatively, you can stop the service and manually download the latest setup file and run it to upgrade Plex.

If you receive a login error or Access Denied when trying to start the service, then post a comment on here and I’ll provide additional instruction.

UPDATE:

The above method still works just fine, even in Windows 10. However, I ended up switching to the method described here: https://forums.plex.tv/discussion/93994/pms-as-a-service using the Plex service wrapper. In addition, I also setup a Plex auto-update service as described here: http://technicallyeasy.net/update-plex-automatically-running-plex-service/

I’m not going to provide another tutorial for these setups since they are outlined pretty well on the respective links.

Hi- thanks for this post. I followed your directions to install Plex as a service, but I’m unable to start the service and get an error that says “Windows could not start the Plex Media Server on local computer” and then directs me to the system log which I know nothing about. Anything you could help with?

I unchecked the PMS “Launch at startup”
At first, I installed nssm 64-bits and installed the PMS as a service successfully.
On my devices, I can see my PMS and my library.
PROBLEM: When I click play to a song, it stays at 0:00 and never play.

I uninstalled nssm 64-bits to try install nssm 32-bits, since my PMS seems to run as 32-bits, even though it is in the Program files (x86) folder.
Same problem.

If i kill the PMS process and start the PMS manually, I can click on play and everything works fine.

But I want to run PMS as a service to make it running even if I am not logged in the computer.

There is most likely a permission issue happening here. When running as a service it may be running in a different context than your user account or something. Did you set the username and password to run the service as to your username and password for Windows? Do videos play and it’s just music that is having the issue? I actually found a new easier way to run an app as a service a d will post directions soon.

Thanks for the post. However now plex doesn’t see my media files. I’m assuming it has to do with my media is on a NAS that is a mapped drive. do you know how to fix this before I spend a bunch of time trying to figure it out?

Mapped drives are available only to the user that they are mapped for. Services by default will usually run as the SYSTEM account which has no access to Network resources or mapped drives for other users. Be sure you set the user account to run the service as. I also personally use the full UNC path (ie. \\SERVER\Share) versus mapped drives. It doesn’t hurt one way or the other, but it seems there are more points of failure with mapped drives such as the mapped drive getting disconnected and not reconnecting or Windows refusing to remap and giving the error of multiple connections not allowed. Also, the UNC path is always available (assuming permissions allow access and the network devicetis available) .

As I was typing a reply to someone else it occurred to me that you will want to use the full UNC path when using Plex as a service. Mapped drives only get mapped when you log into the PC. Therefore, if the service starts and your account is not logged in, the mapped drives will not be present and Plex will not be able to access your files. Use \\SeverName\Path for each of your libraries instead of the mapped drive. Also be sure that plex is running as your user account. You can verify by looking in Task Manager. PlexMediaServer.exe should be listed as running as your username.

Use the PMS Service, it’s free and open source on GitHub. Nssm is generic solution and it’s really great, I use it too for other applications, but where there is a specific solution like PMS Service I prefer the last one.

I followed everything step by step and I am able to get Plex to run as a service, however all my media then become unavailable. All of my media is on a NAS while my Plex server is on a IntelNuc with the NAS as mapped drives.

As I was typing my previous comment I realized that when running as a service you actually will want to use the full UNC path for your library paths. Mapped drives don’t exist outside of your logged on user profile. Since the purpose of running Plex as a service is to be able to have it run without logging in first, mapped drives will not exist when Plex starts without logging into Windows. Also, be sure you have set your service to run as your user account, otherwise the application will run in a different user context and may not have permissions to access the NAS.

I found that the easiest and built-in way is to use task scheduler. Point it to trigger “Plex Media Server.exe” in the plex program folder at computer startup and then make sure to select run whether or not the user is not logged on. That does the trick for me. you’re welcome! :’-)

No, I appreciate the share! Glad you found it useful. While my method in this post works just fine, I actually ended up switching to the more official (yet not official) method of using the PMS service wrapper: https://forums.plex.tv/discussion/93994/pms-as-a-service. What I like about this is that it actually loads a service manager in the taskbar similar to how the normal Plex application works that you can use to start/stop the service or launch the web interface. I can’t remember why I switched excatly, but I think it was because I had trouble getting an auto-update service (http://technicallyeasy.net/update-plex-automatically-running-plex-service/) working otherwise. I wanted to have auto-updates that could run in off hours without me having to check for and perform updates when we were using it. This whole system has been working very well for some time now.