On Thu, Jun 19, 2008 at 10:38 AM, Nicholas Calvert <nick.calvert / gmail.com> wrote: > Hi, > > I'm in the process of transferring a bunch of script from powershell to > ruby to aid interoperability with an existing application and I'm > looking for two ruby equivalents to powershell commands: > > PSBASE is a view which returns the raw view of an object. > getText returns the text between the current location and the specified > location in the buffer. > > I use these a lot with WMI code in powershell, an example: > > $Var1 = path to WMI class or object > $Var1.psbase.gettext(1) > wmi.xml > > This would give me pure XML of a WMI object. I'm not sure that you need PSBASE outside of powershell, I could be wrong, though. GetText in OLE land is called GetText_. Win32OLE example: >> require 'win32ole' => true >> ?> wmi = WIN32OLE.connect("winmgmts://") => #<WIN32OLE:0x2c50740> >> ?> processes = wmi.ExecQuery("select * from win32_process") => #<WIN32OLE:0x2c280c0> >> ?> ?> for process in processes do ?> p process.gettext_(1) >> break >> end "<INSTANCE CLASSNAME=\"Win32_Process\"><PROPERTY NAME=\"__PATH\" CLASSORIGIN=\"_ ... Ruby-WMI example: >> require 'ruby-wmi' => true >> proc = WMI::Win32_Process.find(:first) => #<WIN32OLE:0x2be25e0> >> proc.gettext_(1) => "<INSTANCE CLASSNAME="Win32_Process"><PROPERTY NAME="__PATH" CLASSORIGIN=" ... Hope that helps. Gordon