Get information about the currently extended GPO


  •  We are currently developing an MMC SnapIn Extension, that extends multiple group policy objects (GPOs) in the following tree: GPO->Computer Configuration->Policies->MySnapInExtension

    (Sorry, but no images or links allowed :(  )

    Thechnology is MMC 3.0, .NET 3.5, C#, VS2013. The extension is available on all GPOs.

    The main class of the extension looks like this (in an anonimized way)


    [SnapInSettings("{3B6F64DC-4572-4A64-957A-E8A9E2FEBD54}", DisplayName = "DisplayName", Description = "MMC Snap-In")]
    public class ExtensionSnapIn : NamespaceExtension

    Everything works fine except I cannot determine which GPO is the parent of the currently opened extension. I would like to know this because I have to write into the registry to the following path: HKLM\Software\Company\Product\Client Group Policy\[GPOID]\

    I would like to have the ID (guid) of the GPO dynamically:

    I have tried a lot of things with no result at all:

        In the ExtensionSnapIn class there is an inherited PrimaryScopeNode property which has a NodeType property which is a GUID. Unfortunately, this property always returns 00000000-000-0000-0000-000000000000. However the documentation says that about the PublishesNodeTypeAttribute:

        If a node does not have this attribute, it cannot be registered as an extensible node.

        Whenever I'm trying to read from the PrimaryNode.SharedData like this:

    //private const string shdata = "CCF_SCE_GPT_UNKNOWN";
    //private const string shdata = "CCF_SNAPIN_CLASSID";
    //private const string shdata = "CCF_DISPLAY_NAME";
    //private const string shdata = "CCF_NODETYPE";
    //private const string shdata = "CCF_SZNODETYPE";
    //private const string shdata = "CCF_SNAPIN_CLASSID";
    //private const string shdata = "CCF_DISPLAY_NAME";
    //private const string shdata = "CFSTR_DSOBJECTNAMES";
    private const string shdata = "CCF_SCE_GPT_UNKNOWN";

    public ExtensionSnapIn()
        this.PrimaryNode.SharedData.Add(new SharedDataItem(shdata));

    protected override void OnInitialize()
        SharedDataItem sharedDataItem = this.PrimaryNode.SharedData.GetItem(shdata);

    I'm always getting an exception. For CCF_NODETYPE, CCF_SZNODETYPE, CCF_SNAPIN_CLASSID, CCF_DISPLAY_NAME I'm getting this:

        The following clipboard format is reserved for use by MMC: CCF_DISPLAY_NAME. Specify another clipboard format.

    The rest of the clipboard formats just give a PrimarySnapInDataException with this stack trace:

        at Microsoft.ManagementConsole.SharedDataItem.GetData() at Balabit.SyslogNgAgent.MMC.ExtensionSnapIn.OnInitialize() in c:\Source\Bergholz\Client\Client.Product\Main\src\MMC\ExtensionSnapIn.cs:line 65 at Microsoft.ManagementConsole.Advanced.NamespaceExtension.ProcessNotification(Notification notification) at Microsoft.ManagementConsole.Internal.SnapInClient.Microsoft.ManagementConsole.Internal.IMessageClient.ProcessNotification(Notification notification) at Microsoft.ManagementConsole.Executive.SnapInInitializationOperation.OnStart() at Microsoft.ManagementConsole.Executive.RunningOperationsTable.EnqueueOperation(Operation operation) at Microsoft.ManagementConsole.Executive.NamespaceExtensionComponentData.GetScopeNodeForExpand(IDataObject dataObject, IntPtr hScopeItem) at Microsoft.ManagementConsole.Executive.ComponentData.OnExpand(IDataObject dataObject, Boolean isExpanding, IntPtr hScopeItem) at Microsoft.ManagementConsole.Executive.ExpandMmcNotification.OnNotify(IntPtr dataObject, IntPtr arg, IntPtr param) at Microsoft.ManagementConsole.Executive.MmcNotifyTarget.Notify(IntPtr dataObject, NotificationType eventType, IntPtr arg, IntPtr param)

    I have googled this problem for days, and I have read tons of articles about MMC Extension SnapIns, and GPO, but I have not yet found any usable solutions for my problem.

    Thanks for your help in advance.

    Friday, March 25, 2016 2:57 PM

All replies

  • Hi Istvan,

    Are there any errors related with the problem in Event Viewer?

    If yes, please post them to us for further research.

    Best Regards,


    Please remember to mark the replies as answers if they help and un-mark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact

    Monday, March 28, 2016 8:09 AM