Contact Info

Crumbtrail » Administration » Powershell » Powershell 1.0 » New-Service

New-Service - Powershell 1.0 CmdLet

ActiveXperts Network Monitor ships with integrated Powershell scripts to monitor complex network. The scripts run out of the box
Download the ActiveXperts Network Monitor FREE version now »


Create a new service

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

       A name for the Service.
   -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.

   -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.

       -Verbose, -Debug, -ErrorAction, -ErrorVariable, -OutVariable.

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"