'' REGVIEW v1.0 for Win 2K/XP '' Save or rename this file extension as Regview.VBS or paste into a VBA Macro. '' By Mark Fairpo in response to Brian Grainger's articles on www.icpug.org.uk '' This VBScript allows Technicians to run RegEdit when registry editing is policy-disabled, '' Policy permissions over modifying the Registry Hives remain in-place. '' This template may be reusable elsewhere, but kindly ask that they are not uploaded. Dim i, byteArray, byteZ, strSrcFile, strDestFile, objShell, objStream Const adTypeBinary = 1, adTypeText = 2, adSaveCreateOverWrite = 2 Const conKeyName = "DisableRegistryTools" Const conNormalFocus = 1 '' Part of MDAC, ActiveX Data Object Streams were new to ADO 2.5 '' The ADODB.Stream object is disabled for Internet Explorer see KB870669 Set objShell = CreateObject("WScript.Shell") Set objStream = CreateObject("ADODB.Stream") strSrcFile = objShell.ExpandEnvironmentStrings("%windir%\regedit.exe") strDestFile = objShell.ExpandEnvironmentStrings("%temp%\regedit.exe") '' Load both a binary Stream and an interrogatable Byte-Array from source file objStream.Open objStream.Type = adTypeBinary objStream.LoadFromFile strSrcFile byteArray = objStream.Read '' Read "Z" from legacy DOS-EXE header signature "MZ" objStream.Position = 1 byteZ = objStream.Read(1) '' InStrB compares a double-byte UTF-16 Unicode string in a Byte-Array i = InStrB(1, byteArray, conKeyName, vbBinaryCompare) Do While i > 1 '' Find and scratch any occurences of conKeyName with "Z" objStream.Position = i - 1 objStream.Write byteZ i = InStrB(i + Len(conKeyName), byteArray, conKeyName, vbBinaryCompare) Loop '' Save binary Stream into a temporary executable file and then run objStream.SaveToFile strDestFile, adSaveCreateOverWrite objStream.Close On Error Resume Next '' objShell.RegDelete "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\" & conKeyName '' objShell.RegDelete "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\" & conKeyName objShell.Run strDestFile, conNormalFocus Shell strDestFile, conNormalFocus Set objStream = Nothing Set objShell = Nothing