Pack which allows integration with Windows systems.
Action which runs a provided WQL query on a specified host and returns the result.
For this action to work, WMI client for Linux (wmic) needs to be installed on the host where this action is running. Packages for Ubuntu and other systems are available at https://www.orvant.com/packages/.
host
- Host of a Window machine to run the query on.username
- Account username (defaults toAdministrator
).password
- Account password.query
- WQL query to run.
For information on how to enable and configure WMI, please see the following page - Enable WMI (Windows Management Instrumentation).
- Retrieve process id for all the running processes
Select ProcessId from Win32_Process Where CommandLine like '%java.exe%'
- Retrieve all the information for a particular process
Select * from Win32_Process Where CommandLine like '%java.exe%'
- Retrieve information about Windows services
Select * From Win32_Service
- Retrieve information about free memory
Select FreePhysicalMemory from Win32_OperatingSystem
These require winexe
to be installed and available in the path.
For debian this is available by:
wget http://download.opensuse.org/repositories/home:/uibmz:/opsi:/opsi40-testing/xUbuntu_12.04/amd64/winexe_1.00.1-1_amd64.deb
sudo dpkg --install winexe_1.00.1-1_amd64.deb
The WinRM commands require WinRM to be configured to allow non-domain joined connections (untrusted).
2 actions are provided to set this up via RPC, setup_winrm
and lockdown_winrm
. If you have finished using WinRM, it is recommended to run
the lockdown action.
For more examples, see WMI Query Language by Example.