DSCResources/Resources/windows.xIisLogging.ps1

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
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

$rules = $stig.RuleList | Select-Rule -Type IisLoggingRule

if ($rules)
{
    $logFlags = Get-UniqueStringArray -InputObject $rules.LogFlags -AsString
    $logFormat = Get-UniqueString -InputObject $rules.LogFormat
    $logTargetW3C = Get-UniqueString -InputObject $rules.LogTargetW3C
    $logCustomField = Get-LogCustomField -LogCustomField $rules.LogCustomFieldEntry.Entry -Resource 'xIisLogging'

    $resourceTitle = "[$($rules.id -join ' ')]"

    $scriptBlock = [scriptblock]::Create("
        xIisLogging '$resourceTitle'
        {
            LogPath = '$LogPath'
            LogFlags = @($logFlags)
            LogFormat = '$logFormat'
            LogTargetW3C = '$logTargetW3C'
            LogCustomFields = @($logCustomField)
        }"

    )

    & $scriptBlock
}