[Solved] PostProcessing Script, Can't Call wsl.exe from Batch File

Server Version#: 1.25.4.5468

OK, pulling my hair out with this one :frowning_face:. I have a post processing script that I’m happy with - it was written in Linux, works in bash. I have tried it in WSL (Windows Subsystem for Linux), works great as well. And, I have a batch file that calls it (using wsl.exe) … also works fine.

The only step that breaks (of course … LOL!) is when Plex calls my batch file. It starts the batch, that I have confirmed, but the command to call wsl.exe fails. Again, only from Plex, not running the batch file from CMD or PowerShell - they both are find.

Anyone seen anything similar? Any pointers?

Thanks!

I’m not an expert by any means so I apologize if you have already thought about this. Does Plex have the correct permissions to run .exe?

You may be right! I am logging to a file now, and there is just no output at all from wsl.exe - tried the full path as well. Not even an error message, just no output. Kinda stumped - not sure what the issue is, and hard to tell with no error / output.

Thinking that under Windows it should be running as “me”, no?

Thanks!

OK, just checked - it is in fact running as me. Very odd. Wondering now if wsl.exe won’t run from a script?

I think I found it! If I just add a line in the script, to list all the executables in C:\Windows\System32 … when run from my local shell, it’s fine - wsl.exe is there. But when the same script is called from Plex, it’s missing! Seems this may be a 32 vs. 64 bit issue. I admit, not sure how to get Plex to call the batch file in 64 bit mode.

Thanks!

Nice. I’m glad you figure it out.

I’m running a Ubuntu server. When I created a post processing script, I ran into the same issue as you. I had to give the user “plex” the ability to run the cmd in the plex postprocessing folder. Therefore, I thought that is what the issue might have been.

Appreciate it - thanks!

Ya, figured it out (I think) - but no solution I can find though :frowning_face:. Not sure why Plex is executing the script this way.

OK, got it! It’s screwy, but figured it out - posting here, so hopefully others don’t have to go through the same pain.

The issue is that Plex launches a 32 bit “shell” (Console Host or Terminal) => you can’t directly see 64 bit applications, like wsl. Or at least … not in the usual place (C:\Windows\System32). Rather, in 32 bit mode, you have to access 64 bit applications at C:\Windows\Sysnative! System32 is mapped (for 32 bit applications) to C:\Windows\SysWOW64. Confused yet!!!

Bottom line => in your Windows scripts, make sure to access 64 bit applications through C:\Windows\Sysnative.

Marking this as solved - so hopefully this gets captured in the Plex docs (again, only to spare others the same learning / pain).

Thanks!