Tuesday, July 5, 2011

Ruby WMI Example using Instances

You can download the scripting program for generating these scripts at:

http://www.planetmps.com/wmiscriptsinstances.html

require("win32ole")
i=0
locator = WIN32OLE.new("WbemScripting.SWbemLocator")
svc = locator.connectserver()
svc.Security_.AuthenticationLevel = 0
svc.Security_.ImpersonationLevel = 3
ob = svc.Get("Win32_Process")
objs = ob.Instances
tstr = ""
objs.each{ |obj|
    obj.Properties_.each{ |prop|

End
End

No comments:

Post a Comment