/build/static/layout/Breadcrumb_cap_w.png

VB2012 & Deployed Software

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()
            CheckedListBox1.Items.Add(_KeyName)
        Next
    End Sub

    Private Sub Button2_Click(sender As System.Object, e As System.EventArgs) Handles Button2.Click
        Me.Close()
    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
            _RegistryKey.DeleteSubKey(key)
        Next
        Me.Update()
    End Sub
End Class

4 Comments   [ + ] Show comments
  • >using the code below to delete linked Group Policy software
    First things first...you 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. - anonymous_9363 10 years ago
  • 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}). - alphabeta 10 years ago
  • 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. - EdT 10 years ago
  • if you run gpupdate /force it updates instantly. - alphabeta 10 years ago

Answers (0)

Be the first to answer this question

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ