Common/Get-GPPSection.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 |
function Get-GPPSection { Param ( [Parameter(ParameterSetName = 'ByName', Mandatory)] [string]$GPOName, [Parameter(ParameterSetName = 'ById', Mandatory)] [guid]$GPOId, [Parameter(ParameterSetName = 'ByName')] [Parameter(ParameterSetName = 'ById')] [GPPContext]$Context = $ModuleWideDefaultGPPContext, [Parameter(ParameterSetName = 'ByName', Mandatory)] [Parameter(ParameterSetName = 'ById', Mandatory)] [GPPType]$Type ) if (-not $GPOId) { $GPOId = Convert-GPONameToID -Name $GPOName } $FilePath = Get-GPPSectionFilePath -GPOId $GPOId -Context $Context -Type $Type $FilePathExistence = Test-Path -Path $FilePath if ($FilePathExistence) { [xml]$XmlDocument = Get-Content -Path $FilePath Deserialize-GPPSection -InputObject $XmlDocument } } |