PackageDeployment Module Help

Package Deployment Module

Install-Win32Service Cmdlet

Version 4.0.0.5

Install-Win32Service

Synopsis

Install Service

Syntax

Install-Win32Service [-Name] <String> [[-DisplayName] <String>] [[-PathName] <String>] [-ContinueOnError] [-DesktopInteract] [-StartService] [[-LoadOrderGroupAndDependencies] <String>] [[-StartName] <String>] [[-StartPassword] <String>] [[-ServiceTypeAndErrorControl] <String>] [[-StartMode] <String>] [[-Context] <String>] [<CommonParameters>]

Description

Use this command to install a service or a device for Windows. It is not recommended to install devices.

Parameters

-Context <String>

User: Execution under user account; logging in HKEY_CURRENT_USER, i.e. for the user.
UserPerService: User-related command, execution in Service context.
Computer: Execution under user account; logging in HKEY_CURRENT_MACHINE, i.e. for the computer.
ComputerPerService: Execution in service context; logging in HKEY_LOCAL_MACHINE, i.e. for the computer.

Required

False

Position

8

Accepts pipeline input

False

-ContinueOnError <SwitchParameter>

Continues script execution in spite of errors in the respective command

Required

False

Position

Named

Accepts pipeline input

False

-DesktopInteract <SwitchParameter>

"Allow interaction with the desktop" determines, if the service may provide a user interface for every user who is logged in when the service is started.

Required

False

Position

Named

Accepts pipeline input

False

-DisplayName <String>

Describes the service (full name). (This is the name displayed in the Services dialog box on the Control Panel.)

Required

False

Position

1

Accepts pipeline input

False

-LoadOrderGroupAndDependencies <String>

Combined value of:
Load ordering group
Displays the load ordering group (all services can be grouped in load ordering groups). The list of available service groups is located in the registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\ServiceGroupOrder.
Depends on (groups)
Displays the load ordering group the selected service depends on. The service will only run if at least one member of the group is running (after trying to start all services within a group).
Depends on (services)
Displays the service the selected service depends on. The selected service will only run if this service is already running.

Required

False

Position

3

Accepts pipeline input

False

-Name <String>

Specifies the service name in the service database. The location of the service database is in the registry key: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services.

Required

True

Position

0

Accepts pipeline input

False

-PathName <String>

Specifies the full path and the name of the service's executable file (.EXE).

Required

False

Position

2

Accepts pipeline input

False

-ServiceTypeAndErrorControl <String>

Combined value of:
Service type
Displays a bit pattern specifying the service type. Allowed values:
1 (SERVICE_KERNEL_DRIVER)
2 (SERVICE_FILE_SYSTEM_DRIVER)
4 (SERVICE_ADAPTER)
8 (SERVICE_RECOGNIZER_DRIVER)
16 (SERVICE_WIN32_OWN_PROCESS)
32 (SERVICE_WIN32_SHARE_PROCESS)
Detailed information on the service types can be found in MSDN (CreateService).
If you specify either 16 or 32, and the service is running in the context of the local system account, you additionally specify the following value by adding it: 256 (SERVICE_INTERACTIVE_PROCESS). Example: 16+256=272
ErrorControl
Specifies the behavior of the service in case of an error during service startup.

Required

False

Position

6

Accepts pipeline input

False

-StartMode <String>

Boot: Starts the service when the workstation is switched on.
System: Starts the service at operating system startup after the services with the start type Boot have been started.
Automatic: Starts the service automatically after the services with the start type Boot and System have been started.
Manual: Allows a user or a dependent service to start the selected service.
Disabled: Prevents the service from being started by a user. The service can only be started by the system.

Required

False

Position

7

Accepts pipeline input

False

-StartName <String>

Determines whether a service logs in with a system account or with a user account. Most services log in with a system account.
Empty string = System account = Select this login option if you want the service to log in using a system account.
Domain\UserID = This account = Select this login option to assign a particular user account to a service. Enter the account name with the syntax Domain\UserID.

Required

False

Position

4

Accepts pipeline input

False

-StartPassword <String>

The password for the user account. Please note that password entries are case-sensitive.

Required

False

Position

5

Accepts pipeline input

False

-StartService <SwitchParameter>

Starts the service immediately after it has been installed. Then you no longer need to use the command StartService.

Required

False

Position

Named

Accepts pipeline input

False

<CommonParameters>

For more information about common parameters, type "Get-Help about_CommonParameters".