DSCResources/MSFT_xServiceSet/MSFT_xServiceSet.schema.psm1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
Import-Module "$PSScriptRoot\..\ResourceSetHelper.psm1"

Configuration xServiceSet
{
    [CmdletBinding(SupportsShouldProcess = $true)]
    param (
        [Parameter(Mandatory=$true)]
        [ValidateNotNullOrEmpty()]
        [System.String[]]
        $Name,

        [ValidateSet('Automatic', 'Manual', 'Disabled')]
        [System.String]
        $StartupType,

        [ValidateSet('LocalSystem', 'LocalService', 'NetworkService')]
        [System.String]
        $BuiltInAccount,

        [ValidateSet('Running', 'Stopped')]
        [System.String]
        $State,

        [ValidateSet('Present', 'Absent')]
        [System.String]
        $Ensure,

        [ValidateNotNull()]
        [System.Management.Automation.PSCredential]
        $Credential
    )

    $commonParameterNames = @("StartupType", "BuiltInAccount", "State", "Ensure", "Credential")
    $keyParameterName = "Name"
    $resourceName = "xService"

    # Build common parameters for all xService resource nodes
    [string] $commonParameters = New-ResourceCommonParameterString -KeyParameterName $keyParameterName -CommonParameterNames $commonParameterNames -Parameters $PSBoundParameters

    # Build xService resource string
    [string] $resourceString = New-ResourceString -KeyParameterValues $PSBoundParameters[$keyParameterName] -KeyParameterName $keyParameterName -CommonParameters $commonParameters -ResourceName $resourceName

    $configurationScript = [ScriptBlock]::Create($resourceString)
    . $configurationScript
}