Class WinRmRequestExecutor
java.lang.Object
org.sentrysoftware.metricshub.extension.winrm.WinRmRequestExecutor
- All Implemented Interfaces:
IWinRequestExecutor
The WinRmRequestExecutor class provides utility methods for executing
various WinRm requests locally or on remote hosts.
-
Field Summary
Fields inherited from interface org.sentrysoftware.metricshub.extension.win.IWinRequestExecutor
WBEM_E_INVALID_CLASS, WBEM_E_INVALID_NAMESPACE, WBEM_E_NOT_FOUND -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic StringexecuteRemoteWinRmCommand(@NonNull String hostname, @NonNull WinRmConfiguration winRmConfiguration, @NonNull String command) Execute a WinRM remote commandexecuteWinRemoteCommand(String hostname, IWinConfiguration winConfiguration, String command, List<String> embeddedFiles) executeWmi(@NonNull String hostname, @NonNull IWinConfiguration winConfiguration, @NonNull String query, @NonNull String namespace) Execute a WinRM queryboolean
-
Constructor Details
-
WinRmRequestExecutor
public WinRmRequestExecutor()
-
-
Method Details
-
executeWmi
public List<List<String>> executeWmi(@NonNull @NonNull String hostname, @NonNull @NonNull IWinConfiguration winConfiguration, @NonNull @NonNull String query, @NonNull @NonNull String namespace) throws ClientException Execute a WinRM query- Specified by:
executeWmiin interfaceIWinRequestExecutor- Parameters:
hostname- The hostname of the device where the WinRM service is running (nullfor localhost)winConfiguration- WinRM Protocol configuration (credentials, timeout)query- The query to executenamespace- The namespace on which to execute the query- Returns:
- The result of the query
- Throws:
ClientException- when anything goes wrong (details in cause)
-
isAcceptableException
- Specified by:
isAcceptableExceptionin interfaceIWinRequestExecutor
-
executeWinRemoteCommand
public String executeWinRemoteCommand(String hostname, IWinConfiguration winConfiguration, String command, List<String> embeddedFiles) throws ClientException - Specified by:
executeWinRemoteCommandin interfaceIWinRequestExecutor- Throws:
ClientException
-
executeRemoteWinRmCommand
public static String executeRemoteWinRmCommand(@NonNull @NonNull String hostname, @NonNull @NonNull WinRmConfiguration winRmConfiguration, @NonNull @NonNull String command) throws ClientException Execute a WinRM remote command- Parameters:
hostname- The hostname of the device where the WinRM service is running (nullfor localhost)winRmConfiguration- WinRM Protocol configuration (credentials, timeout)command- The command to execute- Returns:
- The result of the query
- Throws:
ClientException- when anything goes wrong (details in cause)
-