Tuesday, June 7, 2011

WMI example code using Rexx

The following is a code example using Ruby with WMI:

Additional examples can be found at:

http://www.planetmps.com/

locator = .OLEObject~new("WbemScripting.SWbemLocator")
service = locator~ConnectServer(".", "root\cimv2")
service~Security_~AuthenticationLevel = 0
service~Security_~ImpersonationLevel = 3
objs = service~ExecQuery("Select * From SMS_MPInformationEx")
do obj over objs
mystr = obj~GetObjetText_(0)
exit
end

ie = .OLEObject~new("InternetExplorer.Application")
ie~Visible = false
ie~Navigate("about:blank")
ie~document~ParentWindow~clipboarddata~SetData("text", mystr)
ie~Quit()

::requires "OREXXOLE.CLS"

No comments:

Post a Comment