#r "System.Management.dll" #r "System.Web.Extensions.dll" open System.Collections.Generic open System.Management open System.Web.Script.Serialization let json = new JavaScriptSerializer() let toTuple (p: PropertyData) = p.Name, p.Value let fromWmi query = let searcher = new ManagementObjectSearcher(ObjectQuery query) Seq.cast(searcher.Get()) |> Seq.map (fun x -> x.Properties |> Seq.cast |> Seq.map toTuple) |> Seq.map (Map.ofSeq >> Dictionary) fromWmi "SELECT Name, Size FROM Win32_LogicalDisk" |> json.Serialize |> printfn "%s"