Tuesday, December 18, 2007

JScript .NET + WMI

Finding documentation for using WMI with JScript is not easy.
Compile this code with 'jsc' (shipped with .Net) in an exe file

import System;
import System.Management;

var diskSearch = new ManagementObjectSearcher("Select * from Win32_LogicalDisk")
var obj = diskSearch.Get()
var prop = new Object()

for (prop in obj){
print(prop['Caption'])
}


Powered by ScribeFire.