Am trying to set up a VB program using the code below to delete linked Group Policy software from a computer. In the CheckedBoxList the names are the {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}. I'd rather it use the GPO Name from within the key rather than the parent name. Also need to reload/refresh the form when some of the keys are deleted. Any help greatly appreciated.

Imports Microsoft.Win32

Public Class Form1
    Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
        Dim _RegistryKey As Microsoft.Win32.RegistryKey = _
            Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt")
        For Each _KeyName As String In _RegistryKey.GetSubKeyNames()
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
    End Sub

    Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
        Dim _RegistryKey As Microsoft.Win32.RegistryKey = _
            Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Group Policy\AppMgmt", True)
        For Each key As String In CheckedListBox1.CheckedItems
    End Sub
End Class
4 Comments   [ + ] Show Comments


  • >using the code below to delete linked Group Policy software
    First things realise that your code merely deletes the registry data and not the software itself, right? You can only do the latter by removing the machine from the linked GPO's scope.
  • deleting the registry data is what I want. On the reboot the software will reinstall. But I'd rather have it show the GPO Name found in the right hand pane(e.g. Application - Office 2010) rather than the folder Key Name (e.g. {xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}).
  • Isn't group policy refreshed every 90 minutes? Certainly in my experience, trying to change GP settings locally only works until the next GP refresh unless you also change permissions on the affected registry keys to remove system access.
  • if you run gpupdate /force it updates instantly.
Please log in to comment

There are no answers at this time


Answer this question or Comment on this question for clarity
Five Steps for Easier- and More Effective- IT Inventorying
Having an accurate inventory of all your IT assets is critical to ensuring that users are productive and that every dollar is well spent. This white paper outlines five steps that improve inventorying both hardware and software.