Announcement

Collapse
No announcement yet.

Help - Delete reg keys from HKEY_USERS for all users

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Help - Delete reg keys from HKEY_USERS for all users

    Hi all,

    I have an application that does not clean up well after itself after it has been uninstalled.

    I need to delete 2 keys under HKEY_USERS\SID\Software called Maginus and Mancos

    HKEY_USERS\SID\Software\Mancos
    HKEY_USERS\SID\Software\Maginus

    I have found this script, but not sure if this is correct. it is VBS script

    Code:
    '-- Script To Delete Registry Key From All User Profiles in Windows XP
    
    On Error Resume Next
    
    Const HKEY_USERS = &H80000003
    
    strComputer = "."
    
    strKeyPath = ""
    
    Set objRegistry = GetObject("winmgmts:\\" & strComputer & "\root\default:StdRegProv")
    
    strKey="Software\Microsoft\Active Setup\Installed Components\{22d6f312-b0f6-11d0-94ab-0080c74c7e95}"
    
    DeleteSubkeys HKEY_USERS, strKeypath
    
    strKey="Software\Microsoft\Active Setup\Installed Components\{44BBA842-CC51-11CF-AAFA-00AA00B6015B}"
    
    DeleteSubkeys HKEY_USERS, strKeypath
    
    Sub DeleteSubkeys(HKEY_USERS, strKeyPath)
    
    objRegistry.EnumKey HKEY_USERS, strKeyPath, arrSubkeys
    
    If IsArray(arrSubkeys) Then
    
    For Each strSubkey In arrSubkeys
    
    DeleteSubkeys HKEY_USERS, strKeyPath & strSubkey & "\" & strKey
    
    objRegistry.DeleteKey HKEY_USERS, strKeyPath & strSubkey & "\" & strKey
    
    Next
    
    End If
    
    objRegistry.DeleteKey HKEY_USERS, strKeyPath & strSubkey & "\" & strKey
    
    End Sub
    Last edited by Rems; 22nd June 2013, 12:13. Reason: added [code] tags around the code

  • #2
    Re: Help - Delete reg keys from HKEY_USERS for all users

    You can use Group Policy Preferences (GPP) under User Configurations to delete the keys. (http://technet.microsoft.com/en-us/l.../cc753092.aspx)

    But do not use the paths
    HKEY_USERS\SID\Software\Mancos
    HKEY_USERS\SID\Software\Maginus

    instead use the paths
    HKEY_CURRENT_USER\Software\Mancos
    HKEY_CURRENT_USER\Software\Maginus


    If you cannot use GPP, then you can use a user logon script to delete both keys under HKEY_CURRENT_USER\Software

    sample:
    Reg.exe DELETE "HKCU\Software\Mancos" /f
    Reg.exe DELETE "HKCU\Software\Maginus" /f


    Rems

    This posting is provided "AS IS" with no warranties, and confers no rights.

    __________________

    ** Remember to give credit where credit's due **
    and leave Reputation Points for meaningful posts

    Comment

    Working...
    X