Dim Locator, oWMI, WQL, Instances, Instance
Dim fso, temp
Const HKEY_USERS = &H80000003
Const lfile = "Regwatch.log" ' name of new logfile - the file should exists !
Const strComputer = "server.xxx.net"
regkey = ".Default\Control Panel\International\"
On Error Resume Next
' Startup
' ###################################################################
' # copy old Logfile #
' ###################################################################
Set fso = CreateObject("Scripting.FileSystemObject")
temp = WScript.ScriptFullName
i = InStrRev(temp, "\")
temp = Left(temp,i )
lfile = temp & CStr(lfile) ' logfile
' ###################################################################
' # Log to Logfile #
' ###################################################################
If fso.fileExists(lfile) Then
logfile = lfile
temp = appendLog(now & "start " , logfile)
End If
'logfile.WriteLine (Now & " - Created Logfile - ")
' ###################################################################
' # End of : Open new Logfile #
' ###################################################################
' End Startup
strValueName1 = "iDate"
strval1 = ""
strValueName2 = "iTime"
strval2 = ""
strValueName3 = "sDate"
strval3 = ""
strValueName4 = "sShortDate"
strval4 = ""
strValueName5 = "sTime"
strval5 = ""
temp = appendLog(("Values watched :" & strValueName1 & " _ " & strValueName2 & " _ " & strValueName3 & " _ " & strValueName4 & " _ " & strValueName5), logfile)
'count = 10000
'Do While Not count = 0
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"&strComputer & "\root\default:StdRegProv")
Return = objReg.GetExpandedStringValue(HKEY_USERS,regkey,strValueName1,strValue)
If (Return = 0) Then
strval1 = strValue
Else
strval1 = "Error : " & Err.Number
End If
Return = objReg.GetExpandedStringValue(HKEY_USERS,regkey,strValueName2,strValue)
If (Return = 0) Then
strval2 = strValue
Else
strval2 = "Error : " & Err.Number
End If
Return = objReg.GetExpandedStringValue(HKEY_USERS,regkey,strValueName3,strValue)
If (Return = 0) Then
strval3 = strValue
Else
strval3 = "Error : " & Err.Number
End If
Return = objReg.GetExpandedStringValue(HKEY_USERS,regkey,strValueName4,strValue)
If (Return = 0) Then
strval4 = strValue
Else
strval4 = "Error : " & Err.Number
End If
Return = objReg.GetExpandedStringValue(HKEY_USERS,regkey,strValueName5,strValue)
If (Return = 0) Then
strval5 = strValue
Else
strval5 = "Error : " & Err.Number
End If
'logfile.WriteLine (Now & " - Values - ")
temp = appendLog((Now & " - :" & strval1 & " _ " & strval2 & " _ " & strval3 & " _ " & strval4 & " _ " & strval5 ),logfile)
'count = count -1
'Loop
temp = logging("close", logfile)
WScript.Quit
Function appendLog(Inhalt, logfile)
Set FileOut = Fso.OpenTextFile(logfile,8,true)
FileOut.WriteLine (Inhalt)
FileOut.Close
Set FileOut = Nothing
appendLog = True
End Function