'Copyright © 2007 Ramesh Srinivasan. All rights reserved.
'Homepage: http://www.winhelponline.com
'Filename: "regedit_enable.vbs"
'Creation: March 02, 2007
'Description: Resets the "Prevent access to registry editing tools"
'	Policy in Windows Vista. If UAC is enabled, this script needs to 
'	be run from an elevated Command Prompt.
'Compatibility: This script was tested under Windows Vista only.

Option Explicit
Dim WshShell, strUserName, strDomain, strSID
Dim objWMIService, colItems, objItem, arrName, objAccount

Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\.\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_ComputerSystem")

For Each objItem in colItems
    arrName = Split(objItem.UserName, "\")
    strDomain = arrName(0)
    strUserName = arrName(1)
Next

Set objAccount = objWMIService.Get _
    ("Win32_UserAccount.Name='" & strUserName & "',Domain='" & strDomain & "'")
strSID=objAccount.SID

If trim(strSID) <> "" then
	WshShell.RegDelete ("HKEY_USERS\" & strSID & "\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools")
	Msgbox "Completed!"
End if
