WMI.PostEventsInfo Method

Applies to TestComplete 15.47, last modified on January 20, 2023

Description

The method uses the WMI services to obtain information about events that occurred on the computer specified by the ComputerName property and saves this information to the test log. The number of events to be retrieved is specified by the MaxEventCount property. The method obtains information about the last MaxEventCount events.

Declaration

WMI.PostEventsInfo()

Result None

Applies To

The method is applied to the following object:

Result Value

None.

Example

The following example demonstrates how to connect to the WMI service on a local computer and post different information about the computer to the log.

JavaScript, JScript

function Test()
{
  // Specifies the local computer using the ComputerName property
  WMI.ComputerName = ".";

  // Using the ConnectToComputer method
  // WMI.ConnectToComputer(".", "", "");


  // Using the WaitForComputer method
  // WMI.WaitForComputer(".", "", "", 1000000);

  // Posts different information about the computer to the log
  WMI.PostProcessorInfo();
  WMI.PostDrivesInfo();
  WMI.PostInstalledAppsInfo();
  WMI.PostEnvironmentVariableInfo();
  WMI.MaxEventCount = 5;
  WMI.PostEventsInfo();
}

Python

def Test1():
  # Specifies the local computer using the ComputerName property
  WMI.ComputerName = "."

  # Using the ConnectToComputer method
  #WMI.ConnectToComputer(".", "", "");

  # Using the WaitForComputer method
  #WMI.WaitForComputer(".", "", "", 1000000);

  # Posts different information about the computer to the log
  WMI.PostProcessorInfo();
  WMI.PostDrivesInfo();
  WMI.PostInstalledAppsInfo();
  WMI.PostEnvironmentVariableInfo();
  WMI.MaxEventCount = 5;
  WMI.PostEventsInfo();

VBScript

Sub Test
  ' Specifies the local computer using the ComputerName property
  WMI.ComputerName = "."

  ' Using the ConnectToComputer method
  ' Call WMI.ConnectToComputer(".", "", "")


  ' Using the WaitForComputer method
  ' Call WMI.WaitForComputer(".", "", "", 1000000)

  ' Posts different information about the computer to the log
  Call WMI.PostProcessorInfo
  Call WMI.PostDrivesInfo
  Call WMI.PostInstalledAppsInfo
  Call WMI.PostEnvironmentVariableInfo
  WMI.MaxEventCount = 5
  Call WMI.PostEventsInfo
End Sub

DelphiScript

procedure Test;
begin
  // Specifies the local computer using the ComputerName property
  WMI.ComputerName := '.';

  // Using the ConnectToComputer method
  // WMI.ConnectToComputer('.', '', '');


  // Using the WaitForComputer method
  // WMI.WaitForComputer('.', '', '', 1000000);

  // Posts different information about the computer to the log
  WMI.PostProcessorInfo;
  WMI.PostDrivesInfo;
  WMI.PostInstalledAppsInfo;
  WMI.PostEnvironmentVariableInfo;
  WMI.MaxEventCount := 5;
  WMI.PostEventsInfo;
end;

C++Script, C#Script

function Test()
{
  // Specifies the local computer using the ComputerName property
  WMI["ComputerName"] = ".";

  // Using the ConnectToComputer method
  // WMI["ConnectToComputer"](".", "", "");


  // Using the WaitForComputer method
  // WMI["WaitForComputer"](".", "", "", 1000000);

  // Posts different information about the computer to the log
  WMI["PostProcessorInfo"]();
  WMI["PostDrivesInfo"]();
  WMI["PostInstalledAppsInfo"]();
  WMI["PostEnvironmentVariableInfo"]();
  WMI["MaxEventCount"] = 5;
  WMI["PostEventsInfo"]();
}

See Also

ComputerName Property
MaxEventCount Property

Highlight search results