Create a new service, adds an entry in the registry and the service database.

      New-Service [-name] string [-binaryPathName] string 
          -displayName string [-description string] [-DependsOn string[]]
            [-startupType {Automatic | Manual | Disabled}] 
               [-credential PSCredential] [-dependsOn string[]] 
                  [-whatIf] [-confirm] [CommonParameters]

       A name for the new Service. (required)
   -binaryPathName string
       The path to the executable file for the service.

   -displayName string
       The display name for the service.

   -description string
       A description of the service.

   -DependsOn string[]
       The names of other services upon which the new service depends.
       To enter multiple service names, use a comma to separate the names.

   -startupType ServiceStartMode
       Will the service start at system bootup: Automatic or Manual or Disabled

   -credential PSCredential
       Use a credential to validate access to the file. Credential represents
       a user-name, such as "User01" or "Domain01\User01", or a PSCredential
       object, such as the one retrieved by using the Get-Credential cmdlet.
       If you type a user name, you will be prompted for a password.

   -dependsOn string[]
       A comma-separated list Names of other services upon which
       the new service depends.

       Describe what would happen if you executed the command without
       actually executing the command.

       Prompt for confirmation before executing the command.


Create a new entry in the registry and in the Service Database for "SS64service":

PS C:\> new-service SS64service "C:\WINDOWS\System32\svchost.exe -k netsvcs"

“Businesses planned for service are apt to succeed; businesses planned for profit are apt to fail” ~ Nicholas M. Butler

Related PowerShell Cmdlets

Get-Service - Get a list of services.
Restart-Service - Restart a stopped service.
- Resume a suspended service.
- Make and set changes to the properties of a service.
- Start a stopped service.
- Stop a running service.
- Suspend a running service.
Get-CIMinstance win32_service -filter "name='SS64service'"
Windows cmd command: NET START / SC - Service Control.

Copyright © 1999-2024
Some rights reserved