Skip to main content

How Do I Install A Service?

by
Last updated on 3 min read

Built a Windows service? Great. Now you need it running automatically in the background—even when no one's logged in. Without proper installation, your executable will just sit there. The best way to handle this? Use sc.exe or PowerShell. These register your program with Windows so it behaves like a real service.

Quick Fix Summary:

Fire up Command Prompt as Administrator and type:

sc create "MyService" binPath= "C:\path\to\your\service.exe" start= auto

Then wake it up:

sc start "MyService"

What's Happening

Your executable becomes a managed service that starts automatically with Windows.

A Windows service runs invisibly in the background. It doesn't need a window or user interaction. But to become a real service, your program must register with the Service Control Manager (SCM). The SCM tracks every service's status, dependencies, and startup behavior. Run your EXE directly? It won't survive reboots or logouts—that's not how services work.

As of 2026, sc.exe and PowerShell remain the standard tools for service installation. The old InstallUtil.exe method? Mostly obsolete now. It can cause security headaches and compatibility issues. Services installed that way often break after Windows updates or fail to integrate with modern security models.

Step-by-Step Solution

Install your service using sc.exe or PowerShell in four straightforward steps.
  1. Open Command Prompt as Administrator

    • Hit Win + X and pick Terminal (Admin) or Command Prompt (Admin).
    • Or search for "cmd", right-click, and choose Run as administrator.
  2. Create the service using sc.exe

    Run this command, swapping in your actual path:

    sc create "MyService" binPath= "C:\MyApp\MyService.exe" start= auto

    Pro tip: There's a space after binPath= but none after the equals sign in start= auto. The start= auto flag makes it boot with Windows. Want manual control instead? Use start= demand.

  3. Start the service immediately

    sc start "MyService"

    If it balks, check the Windows Event Log for clues (we'll cover troubleshooting next).

  4. Manage the service

    Use these commands to control your new service:

    • sc stop "MyService" – Hit the brakes
    • sc query "MyService" – Check its pulse
    • sc delete "MyService" – Rip it out completely

If This Didn't Work

Check Event Viewer, verify paths, and try PowerShell for better error details.

Service won't start? Let's fix that.

  • Check the Event Viewer

    Open Event Viewer (Win + XEvent Viewer), then navigate to Windows Logs > Application. Look for errors from the Service Control Manager or your service name. Common culprits? Missing dependencies, wrong permissions, or busted paths.

    Microsoft Support notes that service failures usually include error codes—plug them into the Microsoft Error Lookup Tool to decode what went wrong.

  • Verify the executable path

    Double-check that path in binPath=. It must be absolute—no ..\bin\service.exe shortcuts. If your service runs under a specific account, that account needs access to the folder and files. Relative paths often break when Windows starts up.

  • Use PowerShell for more control

    PowerShell gives you cleaner error messages and more options. Run it as Administrator and try:

    New-Service -Name "MyService" -BinaryPathName "C:\MyApp\MyService.exe" -StartupType Automatic

    To wake it up:

    Start-Service -Name "MyService"

    PowerShell also lets you set a friendly DisplayName and Description so it looks better in the Services console.

Prevention Tips

Build and install services the right way from day one.

Don't wait for crashes to learn these lessons.

  • Use a service wrapper

    Tools like NSSM (Non-Sucking Service Manager) handle the heavy lifting. They manage recovery options, logging, and user context far better than raw sc.exe commands. Install once, then use:

    nssm install MyService "C:\path\to\service.exe"

    NSSM doesn't just create a service entry—it lets you configure recovery actions (like restarting after a crash), which sc.exe can't do.

  • Test service behavior before deployment

    Use DebugView from Microsoft's Sysinternals suite to see console output from your service—even when it's running as a service. Catches startup errors early.

    Grab it from the Microsoft Sysinternals page.

  • Set proper recovery options

    In Services.msc, right-click your service, choose Properties → Recovery. Configure what happens on first, second, and subsequent failures (restart the service, run a script, etc.). This keeps your app alive even if it crashes silently.

    Microsoft recommends recovery actions for long-running services in their documentation.

Edited and fact-checked by the TechFactsHub editorial team.
Alex Chen

Alex Chen is a senior tech writer and former IT support specialist with over a decade of experience troubleshooting everything from blue screens to printer jams. He lives in Portland, OR, where he spends his free time building custom PCs and wondering why printer drivers still don't work in 2026.