Kexla is available via NuGet.
Added an option to directly use a string query at C# WMISearcher.Query
for example
var networkQuery = CimV2searcher.Query<NetworkAdapter>("SELECT * FROM Win32_NetworkAdapter");
Added new constructors that enables running queries on remore computers you can now use any combination of
hostname | Authentication Level | domain | user name | password
to create queries on remote computers
for example
var CimV2searcher = new WMISearcher(scope: "root\\CimV2", hostname: "W2019SRV-DEV", username: "Admin", password: "pass123");
-
Add the package to your project via NuGet package manager
-
Use the libary
using Kexla;
- Define your own class based on the property(s) that you need
[WMIClass(name: "Win32_NetworkAdapter")]
public class NetworkAdapter
{
[WMIProps(name: "MACAddress")]
public string MACAddress { get; set; }
public string Caption { get; set; }
public override string ToString()
{
return "MACAddress " + MACAddress
+ " Caption" + Caption;
}
}
4.Query The Data
WMISearcher searcher = new WMISearcher(WMIClassTypes.CimV2);
var networkAdapters = searcher.Query<NetworkAdapter>();