Results 1 to 7 of 7

Thread: Deleting Registry Values not working?

  1. #1
    THEKnet is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2012
    Posts
    4
    Reputation
    0

    Deleting Registry Values not working?

    Hi,

    I haven't done much with VB.net for a long while. I'm trying to create a program I can distribute to remove a key from several hundred computers' registry's.

    Here's my code:

    Code:
    Module Module1
    
    
        Sub Main()
    
    
            Console.Out.WriteLine("Deleting Key")
    
    
            My.Computer.Registry.SetValue("HKEY_CLASSES_ROOT\CLSID\{6C467336-8281-4E60-8204-430CED96822D}\InprocServer32", "", "")
    
    
            Console.Out.WriteLine("Value Deleted")
    
    
            Console.ReadLine()
        End Sub
    
    
    End Module
    I'm running the program as an administrator. No errors are thrown but the value doesn't get touched.

    Any help would be greatly appreciated.
    Last edited by THEKnet; 08-02-2012 at 8:39 AM.

  2. #2
    JohnH's Avatar
    JohnH is offline VB.NET Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Dec 2005
    Location
    Norway
    Posts
    14,225
    Reputation
    2370
    If no exception is thrown it means the operation is successful. That method even creates all the keys and name-value pair if they don't exist, so either you're looking at the wrong place or haven't refreshed the view in Regedit to see the new value.

  3. #3
    THEKnet is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2012
    Posts
    4
    Reputation
    0
    Quote Originally Posted by JohnH View Post
    If no exception is thrown it means the operation is successful. That method even creates all the keys and name-value pair if they don't exist, so either you're looking at the wrong place or haven't refreshed the view in Regedit to see the new value.
    Registry.png

    I set the program to show the before and after values and they were both correct. So it is setting the value. However, the image above shows after I've set the value, after a refresh, even after closing it down.

  4. #4
    Dunfiddlin's Avatar
    Dunfiddlin is offline VB.NET Forum Master
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Posts
    253
    Reputation
    32
    There are various registry values which might be considered to be protected in that the associated program will simply rewrite it if it's deleted. As this appears to be an MS Office setting I would think it highly likely that this is one of them. Why do you need to delete it?

  5. #5
    THEKnet is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2012
    Posts
    4
    Reputation
    0
    Quote Originally Posted by Dunfiddlin View Post
    There are various registry values which might be considered to be protected in that the associated program will simply rewrite it if it's deleted. As this appears to be an MS Office setting I would think it highly likely that this is one of them. Why do you need to delete it?
    It removes the Sharepoint Link from the right click menu. We need to remove it because once the Sharepoint Synchronisation program has started you can't get rid of it.

    If I apply a .reg file to it the value changes and stays changed for everyone who logs onto that machine. We can't send it out through GPO because it won't change it, so I need to create a program that will remove it instead. This way we can deploy it across the entire site.

  6. #6
    Dunfiddlin's Avatar
    Dunfiddlin is offline VB.NET Forum Master
    .NET Framework
    .NET 4.0
    Join Date
    Jun 2012
    Posts
    253
    Reputation
    32
    Can I assume that you got the idea that this was the right way to do this from here? Remove “Shared Folder Synchronization” from Right-click Context Menu

    It isn't! Read through the comments for two far superior methods.

  7. #7
    THEKnet is offline VB.NET Forum Newbie
    .NET Framework
    .NET 4.0
    Join Date
    Aug 2012
    Posts
    4
    Reputation
    0
    Quote Originally Posted by Dunfiddlin View Post
    Can I assume that you got the idea that this was the right way to do this from here? Remove “Shared Folder Synchronization” from Right-click Context Menu

    It isn't! Read through the comments for two far superior methods.
    Ah, I hadn't seen that article. I've created a script using Shell() and it works perfectly. Thank you very much for your help.

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Harvest time tracking