Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
strMatch = "TSM"
Set oReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
strComputer & "\root\default:StdRegProv")
strKeyPath = "SYSTEM\CurrentControlSet\Services"
oReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
intCount = 0
For Each subkey In arrSubKeys
If UCase(Left(subkey, Len(strMatch))) = UCase(strMatch) Then
Wscript.Echo subkey
intCount = intCount + 1
End If
Next
If intCount = 0 Then
Wscript.Echo "No keys found starting with """ & strMatch & """."
End If
~bp
' Constant values
Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."
strMatch = "TSM"
' Create register opject
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")
' Access the root key we want to search
strKeyPath = "SYSTEM\CurrentControlSet\Services"
objReg.EnumKey HKEY_LOCAL_MACHINE, strKeyPath, arrSubKeys
' Look for the desired key
For Each strSubKey In arrSubKeys
If UCase(Left(strSubKey, Len(strMatch))) = UCase(strMatch) Then
' When found process this key
ProcessKey strKeyPath & "\" & strSubKey & "\Parameters"
End If
Next
Sub ProcessKey(strKey)
' Look for "OptionsFile" value
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKey, "OptionsFile", strValue
' If found then update desired values
If Not IsNull(strValue) Then
' Get current value of string
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKey, "ScheduleLog", strValue
If Not IsNull(strValue) Then
' Adjust strValue as needed here, and then update
strValue = Replace(strValue, "C:", "X:")
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKey, "ScheduleLog", strValue
End If
' Get current value of string
objReg.GetStringValue HKEY_LOCAL_MACHINE, strKey, "ErrorLog", strValue
If Not IsNull(strValue) Then
' Adjust strValue as needed here, and then update
strValue = Replace(strValue, "C:", "X:")
objReg.SetStringValue HKEY_LOCAL_MACHINE, strKey, "ErrorLog", strValue
End If
End If
End Sub
~bp
~bp