Group Policy Modelling “The given Key was not present in the dictionary”

I found this recently when running GPO modelling and there is a Microsoft article that describes the symptom caused by using the GPO registry wizard to import registry settings.

https://support.microsoft.com/en-gb/kb/2692409

Unfortunately I was not able to find a quick way and had to look through all GPOs for the Registry Wizard Values key.  Underneath this key, the offending item has a blank type/ value name.

untitled

Advertisements

3 thoughts on “Group Policy Modelling “The given Key was not present in the dictionary”

  1. Hi Steven,

    You’re probably already aware of the following, but I thought it might be helpful to other readers of your blog. The problem doesn’t seem to necessarily involve all items with blank value name and type. From the Resolution section of KB2692409 (the article you linked to), “while you are using the registry browser to select values in a registry key, do not select the parent key together with the values in it. The parent key is auto-selected. This is, when you select a value in a key, a red tick appears automatically on the parent key folder. It is not necessary also to select the parent key.”

    Here is an example of a good Registry wizard selection (note I only checked values to import, not the parent key(s), which are automatically selected [see “red tick mark”]):

    And an example of a bad Registry wizard selection where I also checked the box for a key:

    The entries resulting from the bad selection (problem entry circled):

    Note the entry named “Common”, with a green registry icon. This is the offending entry, generated by checking the box next to the key named “Common.” In the screenshot above in your post, the PublisherBypassList entry was generated by checking the box beside a key named PublisherBypassList, as evident from the expanded Registry Wizard Values tree in the screenshot.

    Fellow IT drudge from across the pond. 🙂

  2. Here’s script I to find the entries with no type. A bit quick and dirty but it’ll do the trick.

    function Recurse-Collection()
    {
    Param(
    $Collection
    )
    if([bool]($Collection.psobject.properties.name -match “Registry”))
    {
    #Write-Host $Collection.Registry.name
    $Collection.Registry.properties
    }
    if([bool]($Collection.psobject.properties.name -match “Collection”))
    {
    foreach($sub in $Collection.collection)
    {
    Recurse-Collection -Collection $sub

    }
    }
    }

    foreach($gpo in (Get-GPO -all))
    {
    [xml]$xmlgpo=$gpo | Get-GPOReport -ReportType XML
    foreach($cn in $xmlgpo.GPO.ChildNodes)
    {
    if($cn.psobject.properties.name -match “ExtensionData”)
    {
    $hasRegEntries=[bool]($cn.ExtensionData.name -match (“Windows Registry”))
    if($hasRegEntries)
    {
    $Registry=$cn.ExtensionData|?{$_.Name -eq “Windows Registry”}
    $regentries=Recurse-Collection $Registry.FirstChild.RegistrySettings
    foreach($reg in $regentries)
    {
    if($reg.type -eq “”)
    {
    Write-Output “$($gpo.Displayname)`t$($cn.name)`t$($reg.action)`t$($reg.hive)\$($reg.key)`t$($reg.name)`t$($reg.type)`t$($reg.value)”
    }
    }
    }
    }
    }
    }

Leave a Reply to regexaurus Cancel reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s