Eric Niquette UI, UX, Accessibility

Why this is useful

Sometimes streams just start acting up and become unresponsive, or you're stuck in a game or application with no way out. These commands have you covered. By creating custom application profiles in Sunshine, you can quickly reboot, shut down, or logout the current user directly from Moonlight.

Just keep in mind that you'll need to have these set up ahead of time so you're prepared when the need arises, and that Sunshine still has to be running, so it won't help if your PC is locked up.

Configuring Sunshine

The idea is to create an application profile which contains the command, which we can then launch from Moonlight. The first step is to create a new application profile.

  1. Open the Sunshine UI (by default found at localhost:47990)
  2. Navigate to the Applications tab
  3. Press the Add new button
  4. Give the application a name, like "Restart" or "Shut down"
  5. Scroll down the page and select the Add detached command button.
  6. In the command text box, drop in one of the following commands:

    • Restart:
      shutdown /r /f /t 0
    • Shut down:
      shutdown /s /f /t 0
    • Log off:
      shutdown /l
  7. Scroll to the bottom of the page and press the Save button
  8. Restart Sunshine when prompted
  9. Fire up Moonlight, connect to the host machine, and launch the appropriate application from the list to trigger the command

You can wake up a PC in Moonlight by selecting it while it's offline and selecting "Send Wake-on-LAN request" from the pop-up menu.

How it works and command options

When you connect to your Sunshine host and launch the application, the command is fired and triggers the reboot, shut down, or log out sequence.

The shutdown command relies on a couple of parameters to process without delay, and to efficiently terminate all applications:

Parameter Description
/r Restarts the computer
/s Shuts down the computer
/l Logs off the current user immediately without terminating the Windows session or applications.
/f Force-quits all applications so they don't prevent the shut down.
/t 0 The timeout period before the command is executed, set to 0 instead of the 30 seconds default.

Check out the full list of parameters from Microsoft for more information.