Cheers Gordon, you are a life saver. Whilst im on the same subject, i am also having trouble creating a new GUID. With Powershell i can do: $NEWGUID = [GUID]::NewGUID().ToString() Do you think its possible to do this with Ruby and ruby-wmi? Many thanks, Nick Gordon Thiesfeld wrote: > On Thu, Jun 19, 2008 at 10:38 AM, Nicholas Calvert > <nick.calvert / gmail.com> wrote: >> 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 -- Posted via http://www.ruby-forum.com/.