1 people like it.

WMI F#

Determining If You Are Running the Checked Build p.48 Windows Internals 5th Edition.

 1: 
 2: 
 3: 
 4: 
 5: 
 6: 
 7: 
 8: 
 9: 
10: 
11: 
12: 
13: 
14: 
15: 
(* Windows Internals 5th Edition, P48 *)
#r "System.Management.dll";;
open System.Management
open System.Collections.Generic

let getObj (scope : string) query = 
  ManagementObjectSearcher(scope, query).Get()

getObj @"\root\cimv2" "SELECT * FROM Win32_OperatingSystem" 
|> Seq.cast 
|> Seq.map(fun (x : ManagementObject) -> 
  [x.["Caption"]
   x.["Debug"]
   x.["Version"] ])
;;
namespace System
namespace System.Management
namespace System.Collections
namespace System.Collections.Generic
val getObj : scope:string -> query:string -> ManagementObjectCollection

Full name: Script.getObj
val scope : string
Multiple items
val string : value:'T -> string

Full name: Microsoft.FSharp.Core.Operators.string

--------------------
type string = System.String

Full name: Microsoft.FSharp.Core.string
val query : string
Multiple items
type ManagementObjectSearcher =
  inherit Component
  new : unit -> ManagementObjectSearcher + 6 overloads
  member Get : unit -> ManagementObjectCollection + 1 overload
  member Options : EnumerationOptions with get, set
  member Query : ObjectQuery with get, set
  member Scope : ManagementScope with get, set

Full name: System.Management.ManagementObjectSearcher

--------------------
ManagementObjectSearcher() : unit
ManagementObjectSearcher(queryString: string) : unit
ManagementObjectSearcher(query: ObjectQuery) : unit
ManagementObjectSearcher(scope: string, queryString: string) : unit
ManagementObjectSearcher(scope: ManagementScope, query: ObjectQuery) : unit
ManagementObjectSearcher(scope: string, queryString: string, options: EnumerationOptions) : unit
ManagementObjectSearcher(scope: ManagementScope, query: ObjectQuery, options: EnumerationOptions) : unit
module Seq

from Microsoft.FSharp.Collections
val cast : source:System.Collections.IEnumerable -> seq<'T>

Full name: Microsoft.FSharp.Collections.Seq.cast
val map : mapping:('T -> 'U) -> source:seq<'T> -> seq<'U>

Full name: Microsoft.FSharp.Collections.Seq.map
val x : ManagementObject
Multiple items
type ManagementObject =
  inherit ManagementBaseObject
  new : unit -> ManagementObject + 6 overloads
  member ClassPath : ManagementPath
  member Clone : unit -> obj
  member CopyTo : path:ManagementPath -> ManagementPath + 7 overloads
  member Delete : unit -> unit + 3 overloads
  member Dispose : unit -> unit
  member Get : unit -> unit + 1 overload
  member GetMethodParameters : methodName:string -> ManagementBaseObject
  member GetRelated : unit -> ManagementObjectCollection + 5 overloads
  member GetRelationships : unit -> ManagementObjectCollection + 5 overloads
  ...

Full name: System.Management.ManagementObject

--------------------
ManagementObject() : unit
ManagementObject(path: ManagementPath) : unit
ManagementObject(path: string) : unit
ManagementObject(path: ManagementPath, options: ObjectGetOptions) : unit
ManagementObject(path: string, options: ObjectGetOptions) : unit
ManagementObject(scope: ManagementScope, path: ManagementPath, options: ObjectGetOptions) : unit
ManagementObject(scopeString: string, pathString: string, options: ObjectGetOptions) : unit
Raw view Test code New version

More information

Link:http://fssnip.net/9U
Posted:12 years ago
Author:David Klein
Tags: wmi , managementobject