From b6170af1f75408effca7f5c825316916f7fb22c6 Mon Sep 17 00:00:00 2001 From: TerminalMan <84923604+SecretiveShell@users.noreply.github.com> Date: Thu, 5 Aug 2021 23:51:44 +0100 Subject: [PATCH] Create WMIQuery.md --- documentation/WMIQuery.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 documentation/WMIQuery.md diff --git a/documentation/WMIQuery.md b/documentation/WMIQuery.md new file mode 100644 index 0000000..f294020 --- /dev/null +++ b/documentation/WMIQuery.md @@ -0,0 +1,28 @@ +# WMIQuerySensor + +The WMI query sensor is and advanced sensor that executes a user defined [WMI query](https://docs.microsoft.com/en-us/windows/win32/wmisdk/wmi-and-sql) and exposes the result. It should return a single value. + +For example, If you wanted to find the current CPU frequency, the command : + +```sql +SELECT * FROM Win32_Processor +``` + +returns + +`|64|9|To Be Filled By O.E.M.|3|Intel64 Family 6 Model 94 Stepping 3|252|1|Win32_Processor|4008|12|64|Intel64 Family 6 Model 94 Stepping 3|CPU0|100|198|1024|8192|0|6|4|GenuineIntel|4008|Intel(R) Core(TM) i7-6700K CPU @ 4.00GHz|4|4|8|To Be Filled By O.E.M.|False|BFEBFBFF000506E3|3|24067|CPU|False|To Be Filled By O.E.M.|U3E1|OK|3|Win32_ComputerSystem|GAME-PC-2016|8|1|False|False|` + +This query cannot be used, and instead you should try + +```sql +SELECT CurrentClockSpeed FROM Win32_Processor +``` + +which results in `4008` for my PC. Because this query retuens a single value (CPU frequency in MHz), it can be used with the current WMI query sensor implementation. + +You can use [WMI Explorer](https://github.com/vinaypamnani/wmie2/tree/v2.0.0.2) to find see what data is available, or alternatively look at the user submited sensors below: + + +|Query|Explanation|Submitted by| +|---|---|---| +|`SELECT username FROM Win32_ComputerSystem`|Shows the current user|@grizzlyjere|