AtYourService
Member
- Reaction score
- 12
- Location
- CT
I kind of pieced this code together because i wanted a single script
that would be able to enable regedit if a virus had disabled it
I tested on windows XP so far
I dont have a vista box or win7 to test this on , but I think it should work
if anyone can test it and let me know
that would be able to enable regedit if a virus had disabled it
I tested on windows XP so far
I dont have a vista box or win7 to test this on , but I think it should work
if anyone can test it and let me know
Code:
' Enable Regedit for 2000,XP,2003,Vista,Win7
' @ Your Service Computer Repair
' will@whatsmypass.com will@yourserv.us
strComputer = "."
Dim strOS, val, val2, itemtype
Dim WshShell, strUserName, strDomain, strSID
Dim objWMIService, objItem, arrName, objAccount
On Error Resume Next
Set WshShell = WScript.CreateObject("WScript.Shell")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colOperatingSystems = objWMIService.ExecQuery("Select * from Win32_OperatingSystem")
For Each objOperatingSystem in colOperatingSystems
strOS = objOperatingSystem.Version
Next
If InStr(1, strOS, "5.", vbTextCompare) Then strOS = "5"
'check if version of windows is below vista
If strOS = 5 Then
''''''''If 2000 or XP do this'''''''''''''''''''''''''
val = "HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools"
val2 = "HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools"
itemtype = "REG_DWORD"
WSHShell.RegDelete val
WSHShell.RegDelete val2
Msgbox "Regedit is now enabled.", 0 + 32,"Complete!"
Else
'''''''''If vista or win7 do this'''''''''''''''''''''
For Each objItem in colOperatingSystems
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 "Regedit is now enabled.", 0 + 32,"Complete!"
End if
End If
Last edited: