Skip to content

Permission denied [generic:13] when executing script via Sunshine Service (Windows 11) #98

@Sieboldianus

Description

@Sieboldianus

Environment:

  • Host OS: Windows 11
  • Sunshine Version: 2026.131.140325
  • ResolutionAutomation Version: 2.2.0
  • Display Driver: IddSampleDriver (Virtual Display)
  • Sunshine Mode: Running as Windows Service (Local System Account)

Description:
The script fails to execute when a Moonlight stream is initiated. Sunshine logs a "Permission denied" error (code 13) when attempting to run StreamMonitor.ps1.

Steps taken:

  1. Installed via Install.bat with admin rights.
  2. Verified folder permissions (Added "Everyone" with Read/Execute rights).
  3. Set Default Terminal to "Windows Console Host" in Windows 11 settings.
  4. Tested manual execution: Running the script via an elevated PowerShell session (RDP) works perfectly and changes the resolution of the virtual display as expected.

Issue:
When Sunshine (running as a Service) tries to trigger the script, it is blocked by the OS.

  • Log error: Error: Couldn't run [...]: System: Permission denied
  • Log error: Error: [...] wait failed with error code [generic:13]

Changing the Sunshine service logon to a user account or running as an application is not a viable option for this headless server setup.

Sunshine Logs:

[2026-03-22 06:47:45.567]: Info: NvEnc: created encoder HEVC P4 async yuv444 10-bit two-pass rfi
[2026-03-22 06:47:45.634]: Info: Creating encoder [av1_nvenc]
[2026-03-22 06:47:45.634]: Info: Color coding: SDR (Rec. 709)
[2026-03-22 06:47:45.634]: Info: Color depth: 10-bit
[2026-03-22 06:47:45.634]: Info: Color range: JPEG
[2026-03-22 06:47:45.743]: Error: NvEnc: gpu doesn't support YUV444 encode
[2026-03-22 06:47:45.743]: Error: NvEnc: NvEncUnregisterAsyncEvent() failed: NV_ENC_ERR_DEVICE_NOT_EXIST
[2026-03-22 06:47:45.782]: Info: Creating encoder [av1_nvenc]
[2026-03-22 06:47:45.782]: Info: Color coding: SDR (Rec. 709)
[2026-03-22 06:47:45.782]: Info: Color depth: 10-bit
[2026-03-22 06:47:45.782]: Info: Color range: JPEG
[2026-03-22 06:47:45.849]: Info: NvEnc: created encoder AV1 P4 async 10-bit two-pass rfi
[2026-03-22 06:47:45.920]: Info:
[2026-03-22 06:47:45.920]: Info: // Ignore any errors mentioned above, they are not relevant. //
[2026-03-22 06:47:45.920]: Info:
[2026-03-22 06:47:45.920]: Info: Found H.264 encoder: h264_nvenc [nvenc]
[2026-03-22 06:47:45.921]: Info: Found HEVC encoder: hevc_nvenc [nvenc]
[2026-03-22 06:47:45.921]: Info: Found AV1 encoder: av1_nvenc [nvenc]
[2026-03-22 06:47:45.921]: Info: Executing Do Cmd: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file "C:\Tools\ResolutionAutomation\StreamMonitor.ps1" -n ResolutionMatcher]
[2026-03-22 06:47:45.922]: Error: Couldn't run [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file "C:\Tools\ResolutionAutomation\StreamMonitor.ps1" -n ResolutionMatcher]: System: Permission denied
[2026-03-22 06:47:45.923]: Error: [C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass -file "C:\Tools\ResolutionAutomation\StreamMonitor.ps1" -

I tried different configuration options, including "Start Elevated" in Sunshine etc. Nothing worked. I tried to debug this now for 2 hours and giving up. Maybe someone has experienced the same issue and has a solution at hand.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions