When you encounter the error message "Createservice Failed 87: The Parameter Is Incorrect," it can be both frustrating and confusing. This error typically occurs in Windows operating systems when attempting to create a new service using the Service Control Manager or command-line tools like `sc.exe`. It highlights an issue with the parameters being provided to the system, often stemming from syntax errors, permission issues, or invalid configurations. If left unresolved, this error can hinder your ability to set up or manage essential services needed for your applications or workflows.
The good news is that this issue is solvable with a structured approach. By understanding the root causes of the error and following a step-by-step troubleshooting process, you can quickly resolve the problem and get back to creating and managing services without interruption. This guide will walk you through actionable solutions, common pitfalls, and best practices to avoid encountering this error in the future.
Quick Reference
- Verify the command syntax to ensure all parameters are correct.
- Run the command prompt or PowerShell as an administrator to avoid permission issues.
- Check for invalid paths or filenames in the service configuration.
Understanding the Root Causes
Before diving into the solutions, let’s explore the most common reasons why the "Createservice Failed 87" error occurs. Knowing these causes can help you identify the right solution faster:
- Incorrect Command Syntax: The `sc.exe` tool requires precise syntax. A misplaced space, missing quotation marks, or incorrect case can lead to this error.
- Insufficient Permissions: Creating a service requires administrative privileges. Running the command without elevated rights will result in failure.
- Invalid File Paths: If the executable file path you’re referencing in the service creation command is incorrect or inaccessible, the system cannot proceed.
- Registry Corruption: Occasionally, problems in the Windows Registry related to services can cause errors when creating new ones.
Step-by-Step Guide to Fix "Createservice Failed 87"
1. Verify the Command Syntax
The most common cause of this error is incorrect syntax in the sc.exe
command. Double-check the command format:
Correct Syntax:
sc create [ServiceName] binPath= "[PathToExecutable]" [Options]
Key Points to Remember:
- Leave a space after the `binPath=` parameter. For example: `binPath= "C:\Program Files\MyApp\myservice.exe"`.
- Ensure the path to the executable is enclosed in quotes if it contains spaces.
- Check for typos in the service name or other parameters.
Example:
If you’re creating a service for an application located at `C:\MyApp\service.exe`, your command should look like this:
`sc create MyService binPath= "C:\MyApp\service.exe"`
Pro Tip: If you’re unsure about the parameters, consult the official documentation for `sc.exe` by running `sc create /?` in the command prompt.
2. Run the Command as an Administrator
Administrative privileges are essential when creating or modifying services. If you’re not running the command prompt or PowerShell as an administrator, the system may block your request.
Steps to Run as Administrator:
- Click the Windows Start button and type "cmd" in the search bar.
- Right-click on "Command Prompt" and select "Run as Administrator."
- Alternatively, if you’re using PowerShell, search for "PowerShell," right-click, and choose "Run as Administrator."
Re-run your service creation command in the elevated prompt to see if the issue resolves.
3. Check the Executable File Path
The binPath
parameter specifies the location of the executable file the service will run. If this path is incorrect or inaccessible, the system cannot create the service.
Steps to Verify the Path:
- Open File Explorer and navigate to the folder containing your executable file.
- Right-click on the file and select "Properties."
- Copy the full file path from the "Location" field and append the file name.
- Ensure the path is accessible and free of typos.
Example:
If your executable file is located at `C:\Program Files\MyApp\myservice.exe`, the `binPath` should be:
`binPath= "C:\Program Files\MyApp\myservice.exe"`
4. Use Registry Editor to Troubleshoot Service Entries
Occasionally, the error may stem from issues in the Windows Registry related to services. Cleaning up invalid or leftover service entries can help resolve the problem.
Warning: Editing the registry can be risky. Proceed with caution and create a backup before making changes.
Steps to Check and Clean Registry Entries:
- Press Win + R to open the Run dialog box.
- Type `regedit` and press Enter to open the Registry Editor.
- Navigate to the following path: `HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services`
- Look for entries related to the service you’re trying to create.
- If you find leftover or invalid entries, right-click and delete them.
Restart your system and retry the service creation command.
5. Test with Minimal Parameters
If the issue persists, try creating the service with minimal parameters to isolate the problem. Start with just the service name and binPath
, and omit optional parameters like DisplayName
or StartType
:
Example:
`sc create TestService binPath= "C:\MyApp\service.exe"`
If this works, gradually add other parameters to determine which one is causing the issue.
Best Practices to Avoid “Createservice Failed 87” Errors
- Always double-check your command syntax before execution.
- Use descriptive service names to avoid conflicts with existing services.
- Ensure the executable file is properly tested and accessible before creating the service.
- Keep your system updated to reduce the risk of registry corruption or compatibility issues.
What should I do if I still get the error after following all steps?
If the issue persists, consider running a system file check using the sfc /scannow
command to repair corrupted system files. Additionally, check the Event Viewer for detailed error logs that might provide further insights.
Can I create services programmatically to avoid command-line errors?
Yes, you can use programming languages like C# or Python to create services programmatically. For example, in C#, you can use the ServiceInstaller
class in the .NET Framework to define and install services with minimal manual intervention.
How do I know if the service was created successfully?
After running the command, open the Services application by typing “services.msc” in the Run dialog box. Look for your service in the list. If it appears, the creation was successful.