If LCase(Right(Wscript.FullName, 11)) = "wscript.exe" Then
strPath = Wscript.ScriptFullName
strCommand = "%comspec% /k cscript """ & strPath & """"
Set objShell = CreateObject("Wscript.Shell")
objShell.Run(strCommand), 1, True
Wscript.Quit
End If
' Duplicate these to account for each abbreviation
Const HKCR = &H80000000
Const HKEY_CLASSES_ROOT = &H80000000
Const HKCU = &H80000001
Const HKEY_CURRENT_USER = &H80000001
Const HKLM = &H80000002
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKUSERS = &H80000003
Const HKEY_USERS = &H80000003
Const HKCC = &H80000005
Const HKEY_CURRENT_CONFIG = &H80000005
'Value types
Const REG_SZ = 1
Const REG_EXPAND_SZ = 2
Const REG_BINARY = 3
Const REG_DWORD = 4
Const REG_MULTI_SZ = 7
strComputer = "."
Set objRegistry=GetObject("winmgmts:\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "HKCU\Software"
If Right(strKeyPath, 1) = "\" Then strKeyPath = Left(strKeyPath, Len(strKeyPath) - 1)
strRoot = UCase(Left(strKeyPath, InStr(strKeyPath, "\") - 1))
strKeyPath = Mid(strKeyPath, InStr(strKeyPath, "\") + 1)
arrChanges = Array(_
"TestValueHere--|--TestValueChanged",_
"TestValue2--|--TestValue2Changed"_
)
For Each strChange In arrChanges
strValueToFind = Split(strChange, "--|--")(0)
strReplaceWith = Split(strChange, "--|--")(1)
Select Case strRoot
Case "HKCR", "HKEY_CLASSES_ROOT"
strRootKey = HKCR
Case "HKCU", "HKEY_CURRENT_USER"
strRootKey = HKCU
Case "HKLM", "HKEY_LOCAL_MACHINE"
strRootKey = HKLM
Case "HKUSERS", "HKEY_USERS"
strRootKey = HKUSERS
Case "HKCC", "HKEY_CURRENT_CONFIG"
strRootKey = HKCC
Case Else
MsgBox "Invalid root key entered."
WScript.Quit
End Select
strFoundAt = ""
SearchKeys strRootKey, strKeyPath, strValueToFind, strReplaceWith
WScript.Echo "Finished searching subkeys."
Next
Sub ChangeValue(strRootPath, strPath, strType, strReplacement)
Wscript.Echo strValueToFind & " was found at" & VbCrLf & _
strPath & VbCrLf & _
"Value Type: " & strType & VbCrLf
strKey = Left(strPath, InStrRev(strPath, "\") - 1)
strValue = Mid(strPath, InStrRev(strPath, "\") + 1)
Select Case strType
Case "String"
On Error Resume Next
intReturn = objRegistry.SetStringValue(strRootPath, strKey, strValue, strReplacement)
Err.Clear
On Error GoTo 0
Case "ExpandedString"
On Error Resume Next
intReturn = objRegistry.SetExpandedStringValue(strRootPath, strKey, strValue, strReplacement)
Err.Clear
On Error GoTo 0
Case "Binary"
On Error Resume Next
intReturn = objRegistry.SetBinaryValue(strRootPath, strKey, strValue, strReplacement)
Err.Clear
On Error GoTo 0
Case "DWord"
On Error Resume Next
intReturn = objRegistry.SetDWORDValue(strRootPath, strKey, strValue, strReplacement)
Err.Clear
On Error GoTo 0
Case "MultiString"
On Error Resume Next
intReturn = objRegistry.SetMultiStringValue(strRootPath, strKey, strValue, Array(strReplacement))
Err.Clear
On Error GoTo 0
End Select
If intReturn = 0 Then
WScript.Echo "Changed from " & strValueToFind & " to " & strReplaceWith & VbCrLf
Else
WScript.Echo "Failed to change from " & strValueToFind & " to " & strReplaceWith
End If
End Sub
Sub SearchKeys(strRootPath, strPath, strFind, strReplaceWith)
'strFoundAt = ""
SearchValues strRootPath, strPath, strFind, strReplaceWith
objRegistry.EnumKey strRootPath, strPath, arrSubkeys
If TypeName(arrSubkeys) <> "Null" Then
For Each objSubkey In arrSubkeys
'WScript.Echo strPath & "\" & objSubKey
SearchKeys strRootPath, strPath & "\" & objSubKey, strFind, strReplaceWith
Next
End If
End Sub
Sub SearchValues(strRootPath, strPath, strFind, strReplaceWith)
strType = ""
objRegistry.EnumValues strRootPath, strPath, arrValueNames, arrValueTypes
If TypeName(arrValueNames) <> "Null" Then
For intVal = LBound(arrValueNames) To UBound(arrValueNames)
Select Case arrValueTypes(intVal)
Case REG_SZ
If VarType(strFind) = vbString Then
objRegistry.GetStringValue strRootPath, strPath, arrValueNames(intVal), strValue
If strValue = strFind Then
strFoundAt = strPath & "\" & arrValueNames(intVal)
strType = "String"
End If
End If
Case REG_EXPAND_SZ
If VarType(strFind) = vbString Then
objRegistry.GetExpandedStringValue strRootPath, strPath, arrValueNames(intVal), strValue
If strValue = strFind Then
strFoundAt = strPath & "\" & arrValueNames(intVal)
strType = "ExpandedString"
End If
End If
Case REG_BINARY
If VarType(strFind) = vbByte Then
objRegistry.GetBinaryValue strRootPath, strPath, arrValueNames(intVal), strValue
If strValue = strFind Then
strFoundAt = strPath & "\" & arrValueNames(intVal)
strType = "Binary"
End If
End If
Case REG_DWORD
If VarType(strFind) = vbString Then
objRegistry.GetDWordValue strRootPath, strPath, arrValueNames(intVal), strValue
If strValue = strFind Then
strFoundAt = strPath & "\" & arrValueNames(intVal)
strType = "DWord"
End If
End If
Case REG_MULTI_SZ
If VarType(strFind) = vbString Then
objRegistry.GetMultiStringValue strRootPath, strPath, arrValueNames(intVal), arrValues
For Each strValue In arrValues
If strValue = strFind Then
strFoundAt = strPath & "\" & arrValueNames(intVal)
strType = "MultiString"
End If
Next
End If
End Select
If strFoundAt <> "" Then
ChangeValue strRootPath, strFoundAt, strType, strReplaceWith
strFoundAt = ""
End If
Next
End If
End Sub
Dim winShl
Dim regVal
Set winShl = CreateObject("WScript.Shell")
regVal = winShl.RegRead("someRegKey")
i cant see this script
can you copy paste to here please ?