Skip to content

Instantly share code, notes, and snippets.

@matchaxnb
Created February 23, 2025 15:29
Show Gist options
  • Save matchaxnb/0725bc877ecf17313fa276c947ae7175 to your computer and use it in GitHub Desktop.
Save matchaxnb/0725bc877ecf17313fa276c947ae7175 to your computer and use it in GitHub Desktop.
Start squeezelite as a Windows service with reduced privileges

Matcha's guide to using Squeezelite on Windows

s/o f4mi i love you f4mi's video on SqueezeBox

You will need

Steps

Local account

Create a local account on your machine. Let's call it Squeezelite for example. You do not want to run squeezelite as the Local System user, haha.

Run as administrator: netplwiz Click on "Local account", set the username, set the password, input whatever for password hint, do not be puppy-brained and forget the password.

Download the files

Put srvany-ng.exe and your squeezelite exe file in a directory, ideally somewhere with no spaces or weird characters because I don't feel like explaining how to escape characters.

We'll assume C:\squeezelite\srvany-ng.exe and C:\squeezelite\squeezelite.exe for the sake of simplicity.

Identify your Sound Mapper interface

This will let you map Squeezelite so it uses the default audio interface of your computer. I'm a musician so I don't necessarily want it to grab my music interface.

Run, in a terminal (cmd.exe) the following

C:\squeezelite\squeezelite.exe -l

It will list a set of interfaces in the following fashion:

Output devices:
  8 - Microsoft Sound Mapper - Output [MME]
  9 - MAIN Left/Right (2- Minifuse 2) [MME]
  10 - LOOPBACK Left/Right (2- Minifus [MME]
  11 - Speakers (2- Sound Blaster Audi [MME]
[...]
  85 - Output () [Windows WDM-KS]
  87 - Speakers (Steam Streaming Speakers Wave) [Windows WDM-KS]

Pick the one that says "Microsoft Sound Mapper", and remember its number (in my case, 8)

Create the service

Open an administrator terminal (right-click, "Run as Administrator") and run the following:

sc.exe create "Squeezelite-nopriv" start= auto obj= ".\Squeezelite" password= "I_am_puppyBRAINEDandForgot" binPath= "C:\squeezelite\srvany-ng.exe"
# This is going to tell you the service was created successfully
sc.exe description Squeezelite-nopriv "A service that runs Squeezelite through a non-privileged account"

We're halfway done. Let's open the registry with regedit.exe and do the following:

  • Navigate to the following key (key = registry "folder"): HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Squeezelite-nopriv
  • Create a new key (right click into the blank window, New -> Key). Call it Parameters
  • Click on Parameters, and inside it create a New -> String value. Call it Application. Set its value (by double-clicking it) to the path to your Squeezelite.exe (without quotes or whatever) so in our case C:\squeezelite\squeezelite.exe
  • Create another String value, call it AppParameters, and set its value to -o <YourInterfaceNumber> (so in my case it's -o 8)

Now the service should be properly configured. Close the registry editor and if you feel pessimistic reboot your computer because touching the registry sometimes requires you to do that.

How do I start and stop the service?

Open the task manager (taskmgr.exe) or the services console (services.msc). Look for "Squeezelite-nopriv" and right-click on it to start or stop it.

If you want to do it the command line way, you need an admin shell and then type:

  • sc start squeezelite-nopriv to start it
  • sc stop squeezelite-nopriv to stop it

How do i set the audio output volume

Open the Windows sound mixer and set it.

What have i done, i want to undo everything i have regrets T_T T_T T_T

Easy:

  • open a terminal as administrator (cmd.exe, right click -> run as administrator)
  • type sc.exe delete Squeezelite-nopriv
  • reboot your computer
  • open the registry and delete the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Squeezelite-nopriv if it still exists
  • go back to silence or hopefully Winamp 2.95/foobar2000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment