Public/Domain/registry-tools.ps1

function Get-ADRecursePolicyKeys {
    [CmdletBinding()]
    param(
        [Parameter(Mandatory = $true)]
        [string]$GPOName
    )
    Write-Verbose "Getting registry values for GPO: $($GPOName)"
    $gpo = [xml](Get-GPOReport -ReportType Xml -Name $GPOName)
    $result = @()
    if ($null -ne $gpo.gpo.Computer.ExtensionData) {
        $key = $gpo.gpo.Computer.ExtensionData.Extension.RegistrySettings.Registry.Properties
        if ($null -ne $key) {
            $key | Add-Member -MemberType NoteProperty -Name Context -Value "Computer"
            $result += $key
        }
    }
    if ($null -ne $gpo.gpo.User.ExtensionData) {
        $key = $gpo.gpo.User.ExtensionData.Extension.RegistrySettings.Registry.Properties
        if ($null -ne $key) {
            $key | Add-Member -MemberType NoteProperty -Name Context -Value "User"
            $result += $key
        }
    }
    return $result
}
# SIG # Begin signature block
# MIIFWwYJKoZIhvcNAQcCoIIFTDCCBUgCAQExCzAJBgUrDgMCGgUAMGkGCisGAQQB
# gjcCAQSgWzBZMDQGCisGAQQBgjcCAR4wJgIDAQAABBAfzDtgWUsITrck0sYpfvNR
# AgEAAgEAAgEAAgEAAgEAMCEwCQYFKw4DAhoFAAQUG0hrYf/ElDAGQHFYLnCCyjb0
# 9GOgggL2MIIC8jCCAdqgAwIBAgIQYseIafgwqaZNeZ4d0CYhxTANBgkqhkiG9w0B
# AQsFADAaMRgwFgYDVQQDEw9LZXZpbiBLdmlzc2JlcmcwHhcNMjMxMjE4MjMxODA0
# WhcNMjQxMjE4MDUxODA0WjAaMRgwFgYDVQQDEw9LZXZpbiBLdmlzc2JlcmcwggEi
# MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDKlNjwOPiKcBJ86HgpMe6dojbh
# 8stpdYz+D9rLchQwSVRLJkay4McHeETdeUTRPgqVZfnt3ExwJpQoEwKw3mKcU+xe
# OQfODBAURPneH6AU774u2es3/qfIWITlW423s4DInw4X1LC4wblD59fnprfF1MpA
# ZvouL+NndDlDjf8JRvHL3XgaD9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