Oct 282013
 

Plex is a great media server. The only thing that really is a disappointment, is that Plex Media Server for Windows isn’t a real server.
Unlike the variant on a Synology Diskstation, it won’t run if you don’t log on your computer. When you log out, Plex will be shut down.

This is a guide to let Plex run as a real server /services.

Make a (domain or local) user account on the computer you’re using as a server. Log in with that user.
Download Plex Media Server from the official site http://www.plexapp.com/desktop/
Install Plex with the default settings. Finish the installation and configure Plex. The settings are saved in the user profile.

Settings are stored in [HKEY_CURRENT_USER\Software\Plex, Inc.\Plex Media Server] and in %LOCALAPPDATA%\Plex Media Server.

Start regedit.exe and remove the following registry key to make sure Plex doesn’t start when you log on.
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
“Plex Media Server”=”\”C:\\Program Files (x86)\\Plex\\Plex Media Server\\Plex Media Server.exe\””
Stop Plex through the task manager.

Download the Windows 2003 resource tools and install them. Just ignore any warnings about compatibility. I’ve installed it on a Windows 2012R2 server and everything works fine. The part we need is srvany.exe. Almost everything can run as a service with this. As Windows 2003 is support is discontinued in April 2014, don’t wait too long.

You can download them here. Install them with the default settings.

There are a few command to install everything as a service but I’ll make it easy for you. Just save the following and save it as a .reg file. Import the file to finish. I’m assuming you’ve used the default paths, like I’ve mentioned earlier, or else you’ve have to change them.

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Plex]
"Type"=dword:00000010
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,\
20,00,46,00,69,00,6c,00,65,00,73,00,20,00,28,00,78,00,38,00,36,00,29,00,5c,\
00,57,00,69,00,6e,00,64,00,6f,00,77,00,73,00,20,00,52,00,65,00,73,00,6f,00,\
75,00,72,00,63,00,65,00,20,00,4b,00,69,00,74,00,73,00,5c,00,54,00,6f,00,6f,\
00,6c,00,73,00,5c,00,73,00,72,00,76,00,61,00,6e,00,79,00,2e,00,65,00,78,00,\
65,00,00,00
"DisplayName"="Plex"
"WOW64"=dword:00000001
"ObjectName"="LocalSystem"
"DependOnService"=hex(7):54,00,63,00,70,00,69,00,70,00,00,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Plex\Parameters]
"AppDirectory"="C:\\Program Files (x86)\\Plex Media Server"
"Application"="C:\\Program Files (x86)\\plex\\Plex Media Server\\Plex Media Server.exe"

Reboot your server.
Log on again and start services.msc. Find the service called Plex and change the properties. Plex doesn’t run as the Local System Account as it needs a profile to save its settings in. Go to the Tab “Log on”.

Fill in the account you’ve used to install Plex.
plex service

Press OK and restart the service. You can now manage Plex by going to http://localhost:32400/web/index.html in your Browser. Change localhost with your server/computers ip if your running it remotely.

 

Update

If you’d like to update the Plex software, go to the command prompt and type: net stop plex. Install the software and reboot your server / pc. Plex will be updated.

  44 Responses to “Running Plex as a service on Windows”

  1. Hi,
    Great instructions! If I wish to adapt this for an x86 based computer what do I change in the .reg file? Obviously “Program Files (x86)” will change to “Program Files”. What do I do with “”WOW64″=dword:00000001”? Anything else need to change?

    Thanks!
    Blaine

    • Many thanks for this tutorial. I make a post on plex forums with a link of your website.
      I just have one problem, I’m must start this service manually (it’s check as “automatic” but doesn’t start). I make a .bat file to avoid this problem and launch plex without login (just power on my server and Yyyahh…)

      Thanks^99

      • Hi Damien,

        Can you look into the eventlog under system and see if there are any errors why the service doesn’t start? I can have a look why it doesn’t work.

  2. You have to change the path for Plex as you’ve found yourself. Don’t forget to change the imagepath. This should be C:Program FilesWindows Resource KitsToolssrvany.exe. For the WOW64 part, I think this can be deleted. I think the following should work but I don’t have a 32 bit machine to test.

    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesPlex]

    “Type”=dword:00000010
    “Start”=dword:00000002
    “ErrorControl”=dword:00000001
    “ImagePath”=hex(2):43,00,3a,00,5c,00,50,00,72,00,6f,00,67,00,72,00,61,00,6d,00,
    20,00,46,00,69,00,6c,00,65,00,73,00,5c,00,57,00,69,00,6e,00,64,00,6f,00,77,
    00,73,00,20,00,52,00,65,00,73,00,6f,00,75,00,72,00,63,00,65,00,20,00,4b,00,
    69,00,74,00,73,00,5c,00,54,00,6f,00,6f,00,6c,00,73,00,5c,00,73,00,72,00,76,
    00,61,00,6e,00,79,00,2e,00,65,00,78,00,65,00,00,00
    “DisplayName”=”Plex”
    “ObjectName”=”LocalSystem”
    “DependOnService”=hex(7):54,00,63,00,70,00,69,00,70,00,00,00,00,00
    [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesPlexParameters]
    “AppDirectory”=”C:\Program Files\Plex Media Server”
    “Application”=”C:\Program Files\plex\Plex Media Server\Plex Media Server.exe”

  3. What an excellent guide! Worked like a charm on my WHS2011 set-up. Thanks so much, Rick.

  4. awesome! just what I was looking for. Many thanks!

  5. Amazing… I am running this on Windows XP service pack 3!!! Resource Kit working like a charm. I had to create a directory called “Program FIles (x86)” in my C: drive in order to replicate the ImagePath in the reg entry (i wasnt about to try and hack that hex code). No biggie! Love this solution, thanks Rick!

    • Hij Matt. you can use the registry key in the comments or change the value in the registry. I won’t be hex anymore when you import it.

  6. Thanks for this guide. I tried to implement it, but have another wrinkle. My media files are stored on a NAS, and the drive gets mapped when the user logs on. Using this method, the files are shown as “Unavailable” – I think because when Plex is running as a service the drive is not mapped. Any solution for this?

    • This is not a real secure solution as the passwords are stored in clear text, but it should do the job.

      Make a batch/cmd file with the following content and fill this in in the registrykey as application instead of “Plex Media Server.exe”.

      net use R: /delete
      net use R: “\nasshare” /user:username password
      “C:Program Files (x86)plexPlex Media ServerPlex Media Server.exe”

      this will first make a mapping to drive R: (this can be any other free drive ) and then start Plex Media Server. Make sure to index the R: drive after this.

      • Avoid the drive mapping and use a UNC path (thus without the need to to store the username and password).

        1. Create an account with the same username and password on the NAS and on the Plex server (i.e. the same account that the PLEX runs the service as).

        2. Logon as the service account to the plex media server and see if you can browse to the UNC path on the NAS (i.e. \NASservernamesharename). This just proves that pass-thru authentication is working.

        3. Within Plex For media specify the UNC path (i.e. \NASservernamesharename).

        4. reboot PC/sever

  7. Just set your computer’s BIOS to restart after power fail. Set the computer to auto log on the appropriate user. Click the box to have plex start automatically at logon.

  8. I’ve just installed the latest update, and the Plex service no longer starts. From the command prompt, it says “The Plex service could not be started.

    The service did not report an error.”

    Any ideas?

    • Try to start the service manual through services.msc. What is the error? Are there any errors in your eventlog?

      • Ah – I found this in Event Viewer…

        Application ‘F:Program Files (x86)PlexPlex Media ServerPlexScriptHost.exe’ (pid 1912) cannot be restarted – Application SID does not match Conductor SID..

        • Does Plex work when you start plex manual?

          • Yes – I can still run it in my local user session. But the service I created cannot be started. I’m assuming the best thing is to remove and re-add the service, now that I see that error in the log. I’ll try that next.

          • What is the error if you start the service manual?

          • “The Plex service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.”

          • I too have the service listed but it’s not Started and when I try to Start it throws “The Plex service on Local Computer started and then stopped. Some services stop automatically if they are not in use by other services or programs.”

            Nothing relevant in System event logs. Running version 2.1.9 of Plex Media Server.

          • Is the location of the appdirectory and application correct in the registry? Also a service not starting should log something in the system log.

          • Thanks for pointing me in the right direction, Rick. The issue was indeed the AppDirectory. In your original post, you recommend adding:

            [HKEY_LOCAL_MACHINESYSTEMCurrentControlSetServicesPlexParameters]
            “AppDirectory”=”C:\Program Files (x86)\Plex Media Server”
            “Application”=”C:\Program Files (x86)\plex\Plex Media Server\Plex Media Server.exe”

            That AppDirectory is incorrect. It should be:
            “AppDirectory”=”C:\Program Files (x86)\Plex\Plex Media Server”

            Once I corrected the AppDirectory path, all is working fine. If your original post is still editable, you may wish to go back and alter that.

          • FYI – I deleted the Registry entry and re-added it. I had changed Plex to be logged in as the Administrator, but, since the default is Local System, I left it as that and rebooted. This seems to have fixed it, at least partially. The service is showing as running, but I cannot navigate to http://127.0.0.1:32400

          • You have to run plex first 1 time manually, configure everything and then add this account for the service. If you don’t configure it first as administrator (your account) it won’t run.

          • Right. I had set up everything previously, and it was working fine for a couple weeks, until I installed the latest update. I’ve updated it to run under Administrator again, but the dashboard still isn’t loading. Not sure what’s up!

          • I think I maybe tracked down the problem. I think the Update installed Plex in the default C: location rather than F: where I had previously specified. Removing everything and trying again…

          • Woohoo – I think it’s working now. I’m going to restart to make sure. Anyway, thanks for your help. I’ve been living without this for the past week and a half!

          • Nice to hear everything is solved now 🙂

  9. This setup has screwed up all my libraries, this is horrible as much as it is good.

  10. This works many thanks

  11. An other alternative is by using the Build in SC.EXE service control tool from Windows.

    sc create “PlexMediaServer” binpath=”C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe” start=auto depend=LanmanServer DisplayName=”Plex Media Server” obj=.\ password=

  12. Hi
    Windows 8.1 doesn’t seem to install the Plex service in services.msc. Any idea what is wrong?

    • Did you reboot your pc?

      • Nevermind. I changed the install location for RK Tools (I have a small SSD as the C:, so I wanted to install to another bigger drive). Obviously I forgot the HEX path in the reg file would then be wrong (and I don’t know how to edit HEX to the new path).

        Anyway, long story short I reinstalled the RK Tools in the default location and it’s there now.

        Thank you!

  13. I was able to successfully have the Plex service show up in the services.msc, and I can access my Plex media just fine. But as soon as I log out, I can’t access it anymore.

    Any idea why?

    • Seems to me the service isn’t running. If you log out the normal Plex process will be stopped. Is the service started?

      • It’s definitely running. And it’s set to Automatic. I was a bit confused with some of the instructions, though. You said, “Reboot your server.” Like, stop the Plex services (in services.msc) and then start them again? I also tried opening srvany.exe, but a command prompt window just flashed on the screen and went away.

        I wasn’t sure what to do, so I rebooted my whole computer.

        As for the credentials (“Fill in the account you’ve used to install Plex.”), when I went to the Plex service properties and went to the logon tab, I entered my profile’s username and password.

        I didn’t create a separate account. I just wanted to use my main account. Do I *need* to create a separate user account just for Plex to make this work?

  14. Works great on Win2012 R2, only deviation from the instructions, I needed another reboot after configuring the logon account in Services.msc, a service restart wasn’t enough.

    Thanks for the tip!

  15. […] First, I had to get Plex to run as a service and I found a great guide to get it running easily. Check it out here:http://cloudsurvivalguide.com/running-plex-service-windows/. […]

  16. Great post!
    Thanks!

  17. I just upgraded; works like a charm. Brilliant instructions

  18. An alternative is to just set your machine to auto-login. Not secure if you have others with physical access to the computer, but I run Plex on a server in a VM, so it’s secure enough for me.

    Windows 7 and up you can use this. Copy and paste, save as a .reg file. Just edit the required fields, double click and done. Next time you reboot the computer will login with the supplied credentials, run whatever is in Startup and put you at a desktop. Set your screensaver to a low time out value (1 or 2 minutes) with password locking to make it vulnerable for only a short period of time.

    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon]
    “AutoAdminLogon”=”1”
    “DefaultUserName”=”WhateverYourLoginIs(Admin?)”
    “DefaultPassword”=”ThePasswordToTheAccount”
    “DefaultDomainName”=”DomainOrComputerNameIfLocalAccount”

 Leave a Reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

(required)

(required)