Tiny F# EDSL for creating system / hardware IDs on Windows using WMI classes
SystemID EDSL Module: module SystemID = open System open System.Management type ClassName = string type PropertyKey = string type PropertyValue = obj type IDComponent = ClassName * PropertyKey [] type IDQueryResult = ClassName * (PropertyKey * PropertyValue)[][] let internal qs (t:ClassName) (ps:PropertyKey[]) = try use mos = new ManagementObjectSearcher( "Select " + String.Join( "," , ps) + " From " + t) let col = mos.Get() let arr = Seq.toArray seq { for o in col do yield seq { for p in o.Properties do yield p.Name, p.Value } |> arr } |> arr with _ -> [|[||]|] let internal gs s = s|>Array.map (Array.filter ( fun e -> match e with k, null -> false |_ ->true )) let internal vs (t, ns) = t,qs t ns |> gs let query