DSCResourceModules/GPOtoDSC/Group-DSCOutput.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
Function Group-DSCOutput
{
    [CmdletBinding()]
    param
    (
        [Parameter(ValueFromPipeLine = $true)]
        [string]$DSCOutput
    )

    begin
    {
        $GroupedOutput = @()
    }

    process
    {
        $DSCOutput -match "VERBOSE: \[(?<Configuration>.*)\]:\s*LCM:\s*\[\s(?<Operation>\S*)\s*(?<Stage>.*)\s\]\s*\[\[(?<Resource>.*)\](?<Name>.*)\].*"
        {
            $Matches.Remove(0)
            $GroupedOutput += [pscustomobject]$Matches
        }
    }

    end
    {
        return $GroupedOutput
    }
}