One excellent tool for Systems Management on Windows is the Windows Management Instrumentation (WMI), which allows you to remotely execute commands and query parameters on a Windows Host. Of course, all modern Windows systems have the WMI Client installed, but what about the Linux clients?
To get the same functionality on a Linux system (I am using Debian in this example), we need to get the following two packages from this website:
- libwmiclient1_1.3.14-3_amd64.deb
- wmi-client_1.3.14-3_amd64.deb
Make sure you get the correct packages for your architecture and Linux distribution. Then install these two packages like so:
root@qcore:~# dpkg -i libwmiclient1_1.3.14-3_amd64.deb
root@qcore:~# dpkg -i wmi-client_1.3.14-3_amd64.deb
Now we are ready to go. The following example shows how to get the size of the WorkingSet of the process “java.exe” running on the remote host 192.168.20.20:
wmic -U Administrator%mysecret //192.168.20.20 "Select WorkingSetSize from Win32_Process Where CommandLine like '%java.exe%'"
Update: I added a set of examples here.
I really like the SQL-like syntax (they call it WQL) and the fact that you can query virtually any parameter of a Windows host. In the future, I might create another post with my Nagios scripts that use WMI for monitoring. For other examples and the documentation of WMI, refer to the corresponding Microsoft TechNet site.
本文介绍了如何在Linux系统上使用Windows Management Instrumentation (WMI) 工具进行远程执行命令和查询参数的方法。通过安装特定的软件包,可以在Linux上实现与Windows主机交互的功能,包括获取进程工作集大小等信息。
3097

被折叠的 条评论
为什么被折叠?



