{"id":19199553,"url":"https://github.com/subconsciouscompute/query-wmi","last_synced_at":"2025-08-16T15:12:15.724Z","repository":{"id":66815495,"uuid":"602981491","full_name":"SubconsciousCompute/query-wmi","owner":"SubconsciousCompute","description":"A crate to query windows WMI in Rust","archived":false,"fork":false,"pushed_at":"2023-03-13T09:59:11.000Z","size":89,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-20T11:32:00.818Z","etag":null,"topics":["mof","monitoring","rust","windows","wmi","wmi-query"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"agpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/SubconsciousCompute.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-17T11:10:32.000Z","updated_at":"2025-02-28T06:47:34.000Z","dependencies_parsed_at":null,"dependency_job_id":"a40c24d6-a702-488d-bc71-f5544ed66173","html_url":"https://github.com/SubconsciousCompute/query-wmi","commit_stats":{"total_commits":27,"total_committers":2,"mean_commits":13.5,"dds":"0.11111111111111116","last_synced_commit":"46767a6be9faa68414455abe1b4ef2bf0adb9c01"},"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SubconsciousCompute%2Fquery-wmi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SubconsciousCompute%2Fquery-wmi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SubconsciousCompute%2Fquery-wmi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/SubconsciousCompute%2Fquery-wmi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/SubconsciousCompute","download_url":"https://codeload.github.com/SubconsciousCompute/query-wmi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253172161,"owners_count":21865472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mof","monitoring","rust","windows","wmi","wmi-query"],"created_at":"2024-11-09T12:27:48.394Z","updated_at":"2025-05-09T01:23:17.907Z","avatar_url":"https://github.com/SubconsciousCompute.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# query_wmi\n\n[![Rust](https://github.com/SubconsciousCompute/query-wmi/actions/workflows/rust.yml/badge.svg?branch=master)](https://github.com/SubconsciousCompute/query-wmi/actions/workflows/rust.yml)\n[![Crates.io](https://img.shields.io/crates/v/query-wmi)](https://crates.io/crates/query-wmi)\n[![docs.rs](https://img.shields.io/docsrs/query-wmi)](https://docs.rs/query-wmi/latest/query_wmi/)\n\nA crate to query `WMI` classes in windows\n\nhttps://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-start-page\n\u003e Windows Management Instrumentation (WMI) is the infrastructure for management data and\n\u003e operations on Windows-based operating systems. You can write WMI scripts or applications to\n\u003e automate administrative tasks on remote computers, but WMI also supplies management data to\n\u003e other parts of the operating system and products—for example, System Center Operations Manager\n\u003e (formerly Microsoft Operations Manager (MOM)), or Windows Remote Management (`WinRM`).\n\u003e Usage:\n\n```rust\nuse query_wmi::{COMLibrary, Variant, WMIConnection};\nuse query_wmi::computer_hardware::{\n    get_Win32_CDROMDrive, get_Win32_ComputerSystem,\n    get_Win32_PCMCIAController, get_Win32_PnPEntity, get_Win32_Processor,\n    get_Win32_SystemEnclosure, get_Win32_TapeDrive, get_Win32_USBHub,\n};\nuse query_wmi::operating_systems::get_Win32_OperatingSystem;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    let com_con = COMLibrary::new()?;\n    dbg!(get_Win32_OperatingSystem(com_con)?);\n    dbg!(get_Win32_CDROMDrive(com_con)?);\n    dbg!(get_Win32_ComputerSystem(com_con)?);\n    dbg!(get_Win32_PCMCIAController(com_con)?);\n    dbg!(get_Win32_PnPEntity(com_con)?);\n    dbg!(get_Win32_Processor(com_con)?);\n    dbg!(get_Win32_SystemEnclosure(com_con)?);\n    dbg!(get_Win32_USBHub(com_con)?);\n    dbg!(get_Win32_TapeDrive(com_con)?);\n    Ok(())\n}\n```\n\n## Return type\n\n`type Query = Vec\u003cHashMap\u003cString, Variant\u003e\u003e`.\n\n`String` is the name of the returned struct field with `Variant` being an enum type.\n\n## Currently included queries:\n\nThe subsections were defined according\nto [WMI Tasks for Scripts and Applications](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks-for-scripts-and-applications),\nyou can find more classes [here](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/operating-system-classes).\n\n[Accounts and Domains](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--accounts-and-domains)\n\n- [Win32_ComputerSystem](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystem)\n- [Win32_Group](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-group)\n\n[Computer Hardware](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--computer-hardware)\n\n- [Win32_CDROMDrive](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-cdromdrive)\n- [Win32_ComputerSystem](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-computersystem)\n- [Win32_PCMCIAController](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-pcmciacontroller)\n- [Win32_PnPEntity](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-pnpentity)\n- [Win32_PointingDevice](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-pointingdevice)\n- [Win32_Processor](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processor)\n- [Win32_SystemEnclosure](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-systemenclosure)\n- [Win32_USBHub](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/cimwin32a/win32-usbhub)\n- [Win32_TapeDrive](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-tapedrive)\n\n[Computer Software](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--computer-software)\n\n- [Win32_Product](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa394378(v=vs.85))\n\n[Dates and Times](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--dates-and-times)\n\n- [Win32_LocalTime](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/wmitimepprov/win32-localtime)\n- [Win32_TimeZone](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-timezone)\n\n[Desktop Management](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--desktop-management)\n\n- [Win32_Desktop](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-desktop)\n- [Win32_DesktopMonitor](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-desktopmonitor)\n- [Win32_StartupCommand](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-startupcommand)\n\n[Disks and File Systems](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--disks-and-file-systems)\n\n- [Win32_DiskQuota](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/wmipdskq/win32-diskquota)\n- [Win32_VolumeChangeEvent](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-volumechangeevent)\n- [Win32_LogicalDisk](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-logicaldisk)\n- [Win32_MappedLogicalDisk](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-mappedlogicaldisk)\n- [Win32_Volume](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa394515(v=vs.85))\n- [Win32_DiskDrive](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-diskdrive)\n- [Win32_DiskPartition](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-diskpartition)\n\n[Event Logs](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--event-logs)\n\n- [Win32_NTLogEvent](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/eventlogprov/win32-ntlogevent)\n- [Win32_NTEventlogFile](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa394225(v=vs.85))\n\n[Files and Folders](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--files-and-folders)\n\n- [CIM_DataFile](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/cim-datafile)\n- [Win32_Share](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-share)\n- [Win32_Directory](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-directory)\n\n[Networking](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--networking)\n\n- [Win32_NetworkAdapterConfiguration](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-networkadapterconfiguration)\n- [Win32_NetworkAdapter](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-networkadapter)\n\n[Operating Systems](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--operating-systems)\n\n- [Win32_OperatingSystem](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-operatingsystem)\n- [Win32_QuickFixEngineering](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-quickfixengineering)\n- [Win32_WindowsProductActivation](https://learn.microsoft.com/en-us/previous-versions/windows/desktop/legacy/aa394520(v=vs.85))\n\n[Performance Monitoring](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--performance-monitoring)\n\n- [Win32_Perf](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-perf)\n- [Win32_PerfFormattedData](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-perfformatteddata)\n- [Win32_PerfRawData](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-perfrawdata)\n\n[Processes](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--processes)\n\n- [Win32_Process](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-process)\n- [Win32_ProcessStartup](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-processstartup)\n\n[Printers and Printing](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--printers-and-printing)\n\n- [Win32_Printer](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-printer)\n\n[Registry](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--registry)\n\n- [Win32_Registry](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-registry)\n\n[Scheduled Tasks](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--scheduled-tasks)\n\n- [Win32_ScheduledJob](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-scheduledjob)\n\n[Services](https://learn.microsoft.com/en-us/windows/win32/wmisdk/wmi-tasks--services)\n\n- [Win32_Service](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-service)\n- [Win32_DependentService](https://learn.microsoft.com/en-us/windows/win32/cimwin32prov/win32-dependentservice)\n\n## Building your own class queries\n\nYou can use the provided `wmi` macro to make your own queries:\n\n```rust\n#![allow(non_snake_case)]\n\nuse query_wmi::wmi;\nuse query_wmi::Query;\nuse paste::paste;\nuse std::collections::HashMap;\nuse query_wmi::COMLibrary;\nuse query_wmi::{Variant, WMIConnection};\n\n// this creates the function `get_CLASS_NAME()`\nwmi! {\n    /// Documentation\n    CLASS_NAME, r\"path_to_namespace\"\n}\n\n// calling it\nlet com_con = COMLibrary::new() ?;\ndbg!(get_CLASS_NAME(com_con)?);\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubconsciouscompute%2Fquery-wmi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubconsciouscompute%2Fquery-wmi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubconsciouscompute%2Fquery-wmi/lists"}