From: Gordon Thiesfeld Date: 2008-06-20T03:44:17+09:00 Subject: Re: Two Ruby equivalents to Powershell commands... On Thu, Jun 19, 2008 at 10:38 AM, Nicholas Calvert 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://") => # >> ?> processes = wmi.ExecQuery("select * from win32_process") => # >> ?> ?> for process in processes do ?> p process.gettext_(1) >> break >> end "> require 'ruby-wmi' => true >> proc = WMI::Win32_Process.find(:first) => # >> proc.gettext_(1) => "