Sunday, February 24, 2008

WMI - FSharp

WMI test is my 'Hello World' :-)

#light
open System
open System.Management

let getLogicalDisk () =
let query = "select * from win32_logicaldisk where drivetype = '3'"
let objMgt = new ManagementObjectSearcher(query)
let result = objMgt.Get()
for info in result do
let caption = info.GetPropertyValue("Caption").ToString()
let size = info.GetPropertyValue("Size").ToString()
printf "%2s : %15s Ko\n" caption size

getLogicalDisk ()

read_line ()

No comments:

Post a Comment