Friday, January 27, 2017

How to run Plex Media Server as a Windows Service

in case their post goes away sometime in the future
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. 
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”. 
Inside of the Administrator Command Prompt, eneter the command: nssm install 
This will launch the NSSM Service Installer.  You now simply need to fill out the needed fields as follows: 
1. On the Application tab, enter:
  - For Windows 32-bit:
     - Path: C:\Program Files\Plex\Plex Media Server\Plex Media Server.exe
     - Startup Directory: C:\Program Files\Plex\Plex Media Server
  - For Windows 64-bit:
     - Path: C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe
     - Startup Directory: C:\Program Files (x86)\Plex\Plex Media Server
2. On the Details tab, enter:
  - Display Name: Plex Media Server (or whatever you would like the service to display as)
  - Startup Type: Automatic
3. 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.
4. 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.
5. Click on Install Service.
6. 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.
-


No comments: