WMI is microsoft’s attempt at making SNMP “better”. Whether they succeed or fail at that is subjective, but querying wmi from a non windows hosts has been a problem in the past and has required lots of hoops and weird proxies. No more! wmic is a command line wmi client that you can install on linux. On a debian based host, just use
apt-get install wmi-client.
Once installed, a simple test like the following should get you lots of wmi goodies. Just remember that you need to use a valid windows account that has permissions to query wmi for this to work.
wmic -U $DOMAIN/$USER%$PASSWORD //$SERVER “Select * from Win32_Service”
$DOMAIN is your AD domain where your user exists
$USER is your username
$PASSWORD is your users password
$SERVER is the server name
A real world example
jason@workstation:~$ wmic -U AD/jason%ohnoes //server.cyborgworkshop.org “Select ProcessID,Started,State from Win32_Service where Name=\”Dhcp\”"
Note that I escaped (\) the quotes on DHCP. It’s important. Do it.
Outputs
CLASS: Win32_Service
Name|ProcessId|Started|State
Dhcp|1196|True|Running