loki-47-6F-64 / sunshine

Host for Moonlight Streaming Client
GNU General Public License v3.0
1.77k stars 152 forks source link

Tutorial on Running Sunshine as a System Service on Windows 10. #28

Open Spamm00r opened 4 years ago

Spamm00r commented 4 years ago

Hi,

the main page describes how to run sunshine as system service on Linux, but a tutorial for Windows is missing.

I tried to run sunshine on windows 10 as a system service but I have trouble when it comes to running it under a session.

Just adding Sunshine as a service and running it does not work. Neither when you let it run as LocalSystem, nor when you specifiy a local admin account.

It does work, when I use FireDaemon's "Start in Session" feature. But that does not work via command line.

Or alternatively one can use free runasservice tool from windows to install a system service.

I wanna be able to start sunshine via a commandline and not manually via logging in.

Can anyone point out how you can make sunshine run and stream as a system service under windows?

Ultimately I just wanna issue: net start sunshine or net stop sunshine to make sunshine available for usage by moonlight. Unfortunately it is not as straight forward as I hoped.

Wapitiii commented 3 years ago

Try to make a batch file with this:

@echo off
:reboot 
cd C:\Sunshine
sunshine.exe
TIMEOUT /T 2
GOTO:reboot

After that, just put it in the startup folder. You can find it by pressing WIN + R and typing shell:startup. Then it should automatically startup.

btw, i also tried to run it as a service but it didn't work, so that is the only solution for me.

thor2002ro commented 2 years ago

here just import task to task scheduler and correct the path in action if necessary

you cant use startup dir for programs that require elevated permission

Sunshine autologon start.zip

The-MAZZTer commented 1 year ago

The above scheduled task can be improved by adding the "--shortcut" argument to the launch program action so the annoying console window does not constantly stick around (though if you want to debug issues with sunshine it may be useful to remove that --shortcut and bring the window back).

I tried messing with other settings so it would not require a logged in user but it does not seem Sunshine supports this configuration; it would need to be improved to properly support it. I didn't dig into why it wasn't working, possibly copying a user's appdata (if sunshine stores any) to one of the built in profile's appdata (such as NETWORK SERVICE) could allow it to run as that profile; I didn't test it.

kristof47 commented 7 months ago

The above scheduled task can be improved by adding the "--shortcut" argument to the launch program action so the annoying console window does not constantly stick around (though if you want to debug issues with sunshine it may be useful to remove that --shortcut and bring the window back).

I tried messing with other settings so it would not require a logged in user but it does not seem Sunshine supports this configuration; it would need to be improved to properly support it. I didn't dig into why it wasn't working, possibly copying a user's appdata (if sunshine stores any) to one of the built in profile's appdata (such as NETWORK SERVICE) could allow it to run as that profile; I didn't test it.

Can u show me where to add that --shortcut line please?

tonyno92 commented 2 months ago

Try this, it worked for me:

Run Sunshine from executable. WIN + R and typing services.msc Find Sunshine Services Right click on it and click Properties Set Startup Type to Automatic

ahahfilip commented 4 days ago

Try this, it worked for me:

Run Sunshine from executable. WIN + R and typing services.msc Find Sunshine Services Right click on it and click Properties Set Startup Type to Automatic

That worked perfectly for me. But I first runned sunshine through the install-service in "Programm Files\Sunshine\scripts", then I used services.msc as by you suggested. I did it that way because I was suspecting that doing it your way it would open the Sunshine terminal at every boot, but I'm not even sure that's true.

Thank you so much!