Contact Info

Crumbtrail

ActiveXperts.com » Administration » Powershell » Powershell 1.0 » New-Service

New-Service - Powershell 1.0 CmdLet

Microsoft Windows PowerShell is a command-line shell and scripting tool based on the Microsoft .NET Framework. It is designed for system administrators, engineers and developers to control and automate the administration of Windows and applications.

More than hundred command-line tools (so called "cmdlets") can be used to perform system administration tasks and Windows Management Instrumentation (WMI). These cmdlets are easy to use, with standard naming conventions and common parameters, and standard tools for piping, sorting, filtering, and formatting data and objects.

New-Service

Description
Create a new service

Usage


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

   -whatIf
       Describe what would happen if you executed the command without
       actually executing the command.
	   
   -confirm
       Prompt for confirmation before executing the command.

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

Example(s)
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"