Returns a field or the whole output record as a string value.
value = objRecord.toNativeString( index );
value = objRecord.toNativeString( separator );
JScript example:
var oLogQuery = new ActiveXObject("MSUtil.LogQuery"); // Create query text var strQuery = "SELECT TimeGenerated, SourceName, EventID, Message FROM System"; // Execute query and receive a LogRecordSet var oRecordSet = oLogQuery.Execute( strQuery ); // Visit all records while( !oRecordSet.atEnd() ) { // Get a record var oRecord = oRecordSet.getRecord(); // Display record information WScript.Echo( "TimeGenerated: " + oRecord.toNativeString(0) ); WScript.Echo( "Whole Record: " + oRecord.toNativeString(", ") ); // Advance LogRecordSet to next record oRecordSet.moveNext(); } // Close LogRecordSet oRecordSet.close();VBScript example:
Dim oLogQuery Dim oRecordSet Dim strQuery Dim f Dim val Set oLogQuery = CreateObject("MSUtil.LogQuery") ' Create query text strQuery = "SELECT TimeGenerated, SourceName, EventID, Message FROM System" ' Execute query and receive a LogRecordSet Set oRecordSet = oLogQuery.Execute( strQuery ) ' Visit all records DO WHILE NOT oRecordSet.atEnd ' Get a record Set oRecord = oRecordSet.getRecord ' Display record information WScript.Echo "TimeGenerated: " & oRecord.toNativeString(0) WScript.Echo "Whole Record: " & oRecord.toNativeString(", ") ' Advance LogRecordSet to next record oRecordSet.moveNext LOOP ' Close RecordSet oRecordSet.close
© 2004 Microsoft Corporation. All rights reserved.