Hello,
I see many people here want Plex to startup with the PC regardless of whether a user is logged in. I like the idea of the PMS as a service wrapper, but always prefer to do things natively in the OS if possible. I don't really want to move my library to a location and set permissions etc to make it work with any user logged in.
Also, I use Server 2012R2 which is allocated 2 Administration RDP connections, so leaving a user logged in 24/7 is kind of a waste, as well as a security issue if you don't set it to lock right away.
As it turns out, it is easy to do once you figure out what the issue is exactly. The issue is a bug in newer versions of Windows as seen at http://support.microsoft.com/kb/2968540.
Essentially what happens is, if you launch a scheduled task it ends up starting before the user path variables are populated so the task ends up running under the desired user's credentials but using the Default profile folder. The Default profile is hidden and can be accessed via C:\Users\Default. This is why the workaround listed in the MS link is to launch an interactive task before the actual task with a 1-2 minute delay between them. This gives the system time to load the profile.
I have found a better way to get around this, which is to use a batch file to set the correct profile variables, then launch PMS. To do this just create a batch file, and place it in your Plex Media Server install folder (Probably C:\Program Files (x86)\Plex\Plex Media Server\)
The batch file should contain the following code;
@rem Sets user profile to desired directory prior to lauching PMS EXE as a scheduled task. set "USERPROFILE=%USERPROFILE%\..\%USERNAME%" set "APPDATA=%USERPROFILE%\AppData\Roaming" set "LOCALAPPDATA=%USERPROFILE%\AppData\Local" "%~dp0\Plex Media Server.exe"
Now in your scheduled task, just call the batch file that you just created and your library will load properly from whatever user is actually running the task.
To create a task open the Task Scheduler and Create a New Task (not Basic).
- On the general tab
- Name your task
- Give it a description if you like
- Select "Change User or Group..." and pick the user that has the Media Library set up.
- Select "Run whether user is logged on or not"
- Change "Configure for:" to your version of Windows
- On the Triggers tab
- Select "New"
- Set "begin the task" to "At startup"
- Select OK
- Select "New"
- On the Actions Tab
- Select "New"
- Select "Browse" and locate your batch file. For example mine is "C:\Program Files (x86)\Plex\Plex Media Server\PMS Launcher.bat"
- Select OK
- Select "New"
- On the Conditions tab
- Uncheck "Start the task only if the computer is on AC power" if you are using a laptop.
- On the Settings tab
- Uncheck "Stop the task if it runs longer than"
- Select OK
- Enter the credentials for the user you picked on the first tab.
Reboot your computer and then login as any other user. Open the task manager and see if "Plex Media Server" is running.
If it is not running go back into the Task Scheduler and see why the task did not run under the "last run result" column. The PMS account needs to be local admin as far as I know. If not you can try using the "Run with highest privledges" check box on the general tab of the task but this might break the batch file.
If it is running, try to access your libraries with the local Plex URL like
http://YOUR.SERVER.IP.ADDRESS:32400/web/index.html
If your libraries are listed then you are good to go. If you get blank libraries then then something went wrong.
Â
MS has told some people that they will not be fixing the bug, as a business case has not been made with an impact high enough to warrant the change.
FYI this is tested and used on Server 2012R2, but should also work on Windows 8/8.1.
