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
Answers (0)
Please log in to answer
Be the first to answer this question
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