Class WinRMWqlExecutor

java.lang.Object
org.metricshub.winrm.wql.WinRMWqlExecutor

public class WinRMWqlExecutor extends Object
  • Constructor Details

    • WinRMWqlExecutor

      public WinRMWqlExecutor(long executionTime, List<String> headers, List<List<String>> rows)
      The WinRMWqlExecutor constructor
      Parameters:
      executionTime - The execution time in milliseconds
      headers - The headers list (copied defensively)
      rows - The value rows list (copied defensively)
  • Method Details

    • getExecutionTime

      public long getExecutionTime()
      Get the execution time of the query.
      Returns:
    • getHeaders

      public List<String> getHeaders()
      Get the headers of the query.
      Returns:
      an unmodifiable view of the headers list
    • getRows

      public List<List<String>> getRows()
      Get the result rows of the query.
      Returns:
      an unmodifiable view of the result rows
    • executeWql

      public static WinRMWqlExecutor executeWql(WinRMHttpProtocolEnum protocol, String hostname, Integer port, String username, char[] password, String namespace, String wqlQuery, long timeout, Path ticketCache, List<AuthenticationEnum> authentications) throws WinRMException, WqlQuerySyntaxException, TimeoutException
      Execute a WQL query and process its result.
      Parameters:
      protocol - The HTTP protocol (HTTP by default)
      hostname - Host to connect to. (Mandatory)
      port - The port (5985 for HTPP or 5986 for HTTPS by default)
      username - The username name. (Mandatory)
      password - The password
      namespace - The namespace default value: "ROOT\\CIMV2"
      wqlQuery - The WQL query (Mandatory)
      timeout - The timeout in milliseconds (throws an IllegalArgumentException if negative or zero)
      ticketCache - The Ticket Cache path
      authentications - List of authentications. only NTLM if absent
      Returns:
      WinRMWqlExecutor result instance with header, rows and execution time.
      Throws:
      WinRMException - For any problem encountered on remote
      WqlQuerySyntaxException - On WQL syntax errors
      TimeoutException - To notify userName of timeout