Cynary / sunshine-virtual-monitor

Scripts and instruction for automatically setting up a lone virtual monitor to stream from sunshine.
GNU General Public License v3.0
29 stars 2 forks source link

issues starting #2

Open fu8765 opened 1 month ago

fu8765 commented 1 month ago

Great work. Some suggestions I had issues with windows refusing to run the ps scripts due to execution policy, can you suggest hour to avoid without bypassing for everything?

Also, you might want to change the do and undo command instructions, it needs quotes for paths with spaces.

Thanks

LeGeRyChEeSe commented 1 month ago

Hello, for execution policy issue, instead of allowing every scripts to be executed on your system, you can set the execution policy to RemoteSigned. The features are :

  • The default execution policy for Windows server computers.
  • Scripts can run.
  • Requires a digital signature from a trusted publisher on scripts and configuration files that are downloaded from the internet which includes email and instant messaging programs.
  • Doesn't require digital signatures on scripts that are written on the local computer and not downloaded from the internet.
  • Runs scripts that are downloaded from the internet and not signed, if the scripts are unblocked, such as by using the Unblock-File cmdlet.
  • Risks running unsigned scripts from sources other than the internet and signed scripts that could be malicious.

You can execute this command from an elevated PowerShell to activate the RemoteSigned execution policy :

Set-ExecutionPolicy RemoteSigned

Source : PowerShell execution policies

Cynary commented 4 weeks ago

I'll take a look - I'm not too familiar with how windows execution policies work, so I appreciate @LeGeRyChEeSe 's links / pointers. It'll take me some time to get on this, though. But one thing I'd suggest is checking if sunshine is running as admin in the background - I wonder if that could be the issue.

oKazuhiro commented 3 weeks ago

I also ran into this issue, but the solution for me was to "Unblock" the file, as Windows had marked the files as potentially harmful.

To Unblock the files from execution:

  1. Right-click on the file (e.g., your .ps1 script).
  2. Select Properties.
  3. In the General tab, near the bottom, you may see a section labeled Security with a checkbox that says:

    This file came from another computer and might be blocked to help protect this computer.

  4. Check the box that says Unblock.
  5. Click Apply, then OK.
brmnjsh commented 2 weeks ago

I've done both suggestions from @LeGeRyChEeSe and @oKazuhiro, to no avail. For the former, my Execution Policy was already set to RemoteSigned and for the latter, the files are not blocked in any way. When removing this functionality from sunshine, and running a game, it works just fine.

The error I see:

[2024:08:27:20:45:43]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2024:08:27:20:45:43]: Info: 
[2024:08:27:20:45:43]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2024:08:27:20:45:43]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2024:08:27:20:45:43]: Info: Executing Do Cmd: [powershell.exe -executionpolicy bypass -windowstyle hidden -file "C:\Users\user\Downloads\sunshine-aio\tools\sunshine-virtual-monitor-main\sunshine-virtual-monitor-main\setup_sunvdm.ps1" %SUNSHINE_CLIENT_WIDTH% %SUNSHINE_CLIENT_HEIGHT% %SUNSHINE_CLIENT_FPS% %SUNSHINE_CLIENT_HDR% > "C:\Users\user\Downloads\sunshine-aio\tools\sunshine-virtual-monitor-main\sunshine-virtual-monitor-main\sunvdm.log" 2>&1]
[2024:08:27:20:45:43]: Info: powershell.exe -executionpolicy bypass -windowstyle hidden -file "C:\Users\user\Downloads\sunshine-aio\tools\sunshine-virtual-monitor-main\sunshine-virtual-monitor-main\setup_sunvdm.ps1" %SUNSHINE_CLIENT_WIDTH% %SUNSHINE_CLIENT_HEIGHT% %SUNSHINE_CLIENT_FPS% %SUNSHINE_CLIENT_HDR% > "C:\Users\user\Downloads\sunshine-aio\tools\sunshine-virtual-monitor-main\sunshine-virtual-monitor-main\sunvdm.log" 2>&1 running with PID 19116
[2024:08:27:20:45:44]: Error: [powershell.exe -executionpolicy bypass -windowstyle hidden -file "C:\Users\user\Downloads\sunshine-aio\tools\sunshine-virtual-monitor-main\sunshine-virtual-monitor-main\setup_sunvdm.ps1" %SUNSHINE_CLIENT_WIDTH% %SUNSHINE_CLIENT_HEIGHT% %SUNSHINE_CLIENT_FPS% %SUNSHINE_CLIENT_HDR% > "C:\Users\user\Downloads\sunshine-aio\tools\sunshine-virtual-monitor-main\sunshine-virtual-monitor-main\sunvdm.log" 2>&1] failed with code [1]

For whatever reason, I'm not seeing sunvdm.log in the folder. Further, when trying to run the command manually, PowerShell just dies.

LeGeRyChEeSe commented 2 weeks ago

@brmnjsh Check my repo i fixed that issue with the new release.

LifeDreamer24 commented 1 week ago

@LeGeRyChEeSe I couldn't create an issue so here we go: Can you make the scripts disable the main display's driver upon connecting? I am using your scripts with this but it disables the the touch keyboard to be docked due to more than one adapter being connected on the same device (as if an external screen was plugged) Hopefully it is possible :)

Cynary commented 1 week ago

@LifeDreamer24 I created a new issue for you #8 - let's discuss it there. @fu8765 / @brmnjsh can you check if it's working with @LeGeRyChEeSe 's changes now? I'll wait for a couple weeks for a response, but will close this if we don't see an update in the next couple of weeks.