Git Product home page Git Product logo

Comments (15)

alekdavis avatar alekdavis commented on July 19, 2024

Please check #4

from plexbackup.

yangqi avatar yangqi commented on July 19, 2024

Thank you, read through that one. And I have tested running the command manually.

Start-Process <PMS> -LoadUserProfile

Run this in Powershell with Administrator, got the same issue as the script.
Run this in Powershell without Administrator, everything seems fine.

Both cases, the PMS shows running under current user in task manager, the only difference is the UAC Virtualization column, first one said "Not allowed", second says "Disabled". Not sure if this is related or not though.

from plexbackup.

alekdavis avatar alekdavis commented on July 19, 2024

The problem is that the script needs to run as Administrator; otherwise, it will not have permissions to stop and start services and processes. If you have any ideas, throw them at me and I'll give them a try.

from plexbackup.

alekdavis avatar alekdavis commented on July 19, 2024

Okay, give this a try. Change line 1808 from:

Start-Process $plexServerExePath -LoadUserProfile

to

runas /trustlevel:0x20000 "$plexServerExePath"

See if this helps.

from plexbackup.

alekdavis avatar alekdavis commented on July 19, 2024

@yangqi Any luck?

from plexbackup.

Doughboy68 avatar Doughboy68 commented on July 19, 2024

Hi first of all thanks for the script.

I have the same problem with network shares and came here. I created a test Powershell with various ways to run the Plex Media Server.exe and none of these work (I comment out all of them here but I would uncomment to try different approaches):

The user/pass for my server is plex\plex
`$username = 'plex'
$password = 'plex'

$securePassword = ConvertTo-SecureString $password -AsPlainText -Force
$credential = New-Object System.Management.Automation.PSCredential $username, $securePassword
#Start-Process -FilePath "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -Credential $credential
#runas /trustlevel:0x20000 "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe"
#Start-Process -FilePath "C:\Program Files (x86)\Plex\Plex Media Server\Plex Media Server.exe" -LoadUserProfile -Credential $credential
`
The only way I can get it to work as in recognize paths/play video is end the task from tool tray and run it from the Windows Start Menu then it recognizes the paths and plays correctly.

This has me stumped, but it believe it has to do with Administrator permissions for network folders, however I do verify in task manager that the services are running under Plex user correctly so ???

Can you add a reboot option... my Windows Plex server is set to auto login so this would be a workaround... I suppose I can just add this in code myself too for now - Restart-Computer
Would be nice to learn why PowerShell and Plex behaves this way.

from plexbackup.

alekdavis avatar alekdavis commented on July 19, 2024

@Doughboy68: Have you tried my suggestion for @yangqi above? I have been testing it daily for the last week, and it seems to be working for me (I am also using an option to log off all currently logged users). It could be a coincidence, though, since this particular problem comes and goes. Also, it has nothing to do with Plex per se, and it's not an issue of PowerShell, I think. It does not happen when you run the script interactively and only occurs when you run it as a scheduled task. So it looks like some bug in Windows Scheduled Tasks app. Anyway, give my suggestion a try and let me know.

from plexbackup.

alekdavis avatar alekdavis commented on July 19, 2024

I added a reboot option so this is the workaround I am using for now. If anyone figures out why scheduled tasks mess up remote share connection, please let me know.

from plexbackup.

K-Bong avatar K-Bong commented on July 19, 2024

Hi Alek,

Have recently found your script and after some trouble figuring it out (total noob). I've finally got it work and it's awesome!

I have however run into this old issue though #26. I was just wondering if you figured out anything additional since Aug 2020?

I've changed line 2331/2332, and tried both of these below as you suggested and still get the issue unfortunately.

Start-Process $plexServerPath -LoadUserProfile

runas /trustlevel:0x20000 "$plexServerPath"

Was wondering if you've come up with anything since then? Just a bit iffy to run it as a scheduled task at the moment as I'd have to reboot the application everytime.

from plexbackup.

alekdavis avatar alekdavis commented on July 19, 2024

Hi K-Bong. No, haven't figured it out. I suspect it's an issue with Windows Scheduled tasks or something related to the tasking subsystem (since it only happens when the script runs as a scheduled task). I just have mine configured to reboot with autologin.

from plexbackup.

K-Bong avatar K-Bong commented on July 19, 2024

Thanks for responding. I do get the issue when running the script directly from PowerShell, and as a scheduled task by the way.

But it's no biggie, I might just try what you mentioned or just run the script manully, cheers!

from plexbackup.

alekdavis avatar alekdavis commented on July 19, 2024

Oh, in my observation, it was always a Scheduled Tasks issue. Are you saying that even when you run it manually in PowerShell, you get the same problem? That would be even more weird.

from plexbackup.

K-Bong avatar K-Bong commented on July 19, 2024

Yep. I wanted to make sure the script worked first before running the scheduled task. I would see the behaviour throughout the whole thing, whether I ran it from powershell or through task scheduler.

from plexbackup.

alekdavis avatar alekdavis commented on July 19, 2024

That's bizarre. I am wondering if when you run it from PowerShell, the profile by default gets connected to a share with no permissions. I wish I know how to address this one.

from plexbackup.

K-Bong avatar K-Bong commented on July 19, 2024

Yeah. Otherwise it works well, so appreciated. Sure you'll keep us updated if you do figure something out.

from plexbackup.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.