Parsers/GPO/Envionment.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
#region GPO Parsers
Function Write-GPOEnvironmentVariablesXMLData
{
    [CmdletBinding()]
    [OutputType([String])]
    param
    (
        [Parameter(Mandatory=$true)]
        [System.Xml.XmlElement]$XML    
    )

    $envHash = @{}

    $Properties = $XML.Properties

    $envHash.Name = $Properties.Name
    $envHash.Value = $Properties.Value
    $envHash.Path = [bool]$Properties.partial
    $envHash.Ensure = switch ($Properties.action) { "D" { "Absent" } Default { "Present" } } 


    Write-DSCString -Resource -Name "Environment(XML): $($envHash.Name)" -Type Environment -Parameters $envHash
}
#endregion