Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jcapellman/cwmii
Clean WMI Interface (CWMII) written in C# providing a strongly typed interface to access WMI Properties and Classes
https://github.com/jcapellman/cwmii
csharp-library net5 security-tools wmi
Last synced: about 5 hours ago
JSON representation
Clean WMI Interface (CWMII) written in C# providing a strongly typed interface to access WMI Properties and Classes
- Host: GitHub
- URL: https://github.com/jcapellman/cwmii
- Owner: jcapellman
- License: mit
- Created: 2021-01-19T23:26:53.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2024-05-19T13:33:39.000Z (6 months ago)
- Last Synced: 2024-11-10T20:52:05.873Z (5 days ago)
- Topics: csharp-library, net5, security-tools, wmi
- Language: C#
- Homepage:
- Size: 147 KB
- Stars: 3
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CWMII
Clean WMI Interface (CWMII) written in C# providing a strongly typed interface to access WMI Properties and Classes
NuGet: https://www.nuget.org/packages/CWMII/
A common method of accessing WMI objects is to utilize System.Management, however this creates block of code like so:
```
ManagementObjectSearcher searcher =
new ManagementObjectSearcher("root\\CIMV2", "SELECT * FROM Win32_BIOS");foreach (ManagementObject queryObj in searcher.Get())
{
Console.WriteLine("Manufacturer: {0}", queryObj["Manufacturer"]);
}
```And you've probably created wrapper methods to take a WMI Query as an argument, however this leads to typos and spelling errors in the query itself.
The CWMII interface allows this same query to be simply:
```
CWMII.lib.Enums.Win32_BIOS.Manufacturer.GetWMIValue();
```If you'd liked mulitple properties of let's say Win32_BIOS:
```
lib.CWMII.GetProperties();
```This returns a Dictionary where the Key is the property name.