Skip to content

Latest commit

 

History

History
192 lines (156 loc) · 3.87 KB

WindowsServices.adoc

File metadata and controls

192 lines (156 loc) · 3.87 KB

DSC Resource 'WindowsServices'

WindowsServices installs Windows Optional Features on a Windows Client OS.

Source

DSC Resource

Documentation

Table 1. Attributes of category 'WindowsServices'
Parameter Attribute DataType Description Allowed Values

Services

Mandatory

Hashtable[]

List of Windows services

Table 2. Attributes of category 'WindowsServices/Services'
Parameter Attribute DataType Description Allowed Values

Name

String

Indicates the service name.

Note that sometimes this is different from the display name.
You can get a list of the services and their current state with the Get-Service cmdlet.

BuiltInAccount

String

Indicates the sign-in account to use for the service.

  • LocalService

  • LocalSystem

  • NetworkService

DisplayName

String

The display name of the service.

Path

String

The path to the service executable file.

GroupManagedServiceAccount

String

The Group Managed Service Account to run the service under

Credential

PSCredential

Indicates credentials for the account that the service will run under.

StartupType

String

Indicates the startup type for the service.

  • Automatic

  • AutomaticDelayedStart

  • Disabled

  • Manual

State

String

Indicates the state you want to ensure for the service.

If no value is specified a default value is set with the following conditions:

  • StartupType is empty → Running

  • StartupType is AutomaticRunning

  • StartupType is DisabledStopped

  • StartupType is ManualIgnore

  • Ignore

  • Running

  • Stopped

Description

String

The description of the service.

StartupTimeout

Uint32

The time to wait for the service to be running in milliseconds.

Default: 30000

TerminateTimeout

Uint32

The time to wait for the service to be stopped in milliseconds.

Default: 30000

Dependencies

String[]

An array of strings indicating the names of the dependencies of the service.

DesktopInteract

Boolean

The service can create or communicate with a window on the desktop. Must be False for services not running as LocalSystem.

  • True

  • False (default)

Ensure

Boolean

Indicates whether the target service exists on the system.
Set this property to Absent to ensure that the target service does not exist. Setting it to Present ensures that target service exists.

  • Present (default)

  • Absent

Example
WindowsServices:
  Services:
    - Name: Dummy1
      DisplayName: Dummy Service
      Path: C:\Dummy.exe
      Credential: '[ENC=PE9ianM...=]'
      StartupType: Automatic
      State: Running
      Description: none
      Ensure: Present
    - Name: Dummy2
      StartupType: Manual
Recommended Lookup Options in Datum.yml (Excerpt)
default_lookup_options: MostSpecific

lookup_options:

  WindowsServices:
    merge_hash: deep
  WindowsServices\Services:
    merge_hash_array: UniqueKeyValTuples
    merge_options:
      tuple_keys:
        - Name