# Collecting remote system information

**URL:** <https://rubytalk.org/t/collecting-remote-system-information/40262>\
**Category:** ruby-talk\
**Created:** [30 August 2007 08:04 UTC](https://rubytalk.org/t/collecting-remote-system-information/40262 "2007-08-30T08:04:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Henderson](https://avatars.discourse-cdn.com/v4/letter/c/b77776/32.png) [@Chris\_Henderson](https://rubytalk.org/u/Chris_Henderson)\
**Post date:** [30 August 2007 08:04 UTC](https://rubytalk.org/t/collecting-remote-system-information/40262/1 "2007-08-30T08:04:55Z")

</div>

I am relatively new to coding and to ruby.

I have seen programs like IBM Director installs an agent on a client  
machine and gather all kinds of information remotely; eg. amount of  
ram, processor type and speed, machine type and serial number, OS  
running, netbios name etc.

Would it be possible to write something like this with ruby. Ideally,  
the ruby program will run on Fedora or OpenBSD and the clients are  
Windows XP machines. Once the program is being run it will ask for the  
Windows box's user name and password to gather all the information and  
will dump it in STDOUT.

Any hints or tips on where to start looking to write something like  
this would be much appreciated.

Thanks.

---

<div class="post-metadata">

**Author:** ![M\_Edward\_Ed\_Borasky1](https://avatars.discourse-cdn.com/v4/letter/m/e9c0ed/32.png) [@M\_Edward\_Ed\_Borasky1](https://rubytalk.org/u/M_Edward_Ed_Borasky1)\
**Post date:** [30 August 2007 13:53 UTC](https://rubytalk.org/t/collecting-remote-system-information/40262/2 "2007-08-30T13:53:49Z")

</div>

Chris Henderson wrote:

> I am relatively new to coding and to ruby.
> 
> I have seen programs like IBM Director installs an agent on a client  
> machine and gather all kinds of information remotely; eg. amount of  
> ram, processor type and speed, machine type and serial number, OS  
> running, netbios name etc.
> 
> Would it be possible to write something like this with ruby. Ideally,  
> the ruby program will run on Fedora or OpenBSD and the clients are  
> Windows XP machines. Once the program is being run it will ask for the  
> Windows box's user name and password to gather all the information and  
> will dump it in STDOUT.
> 
> Any hints or tips on where to start looking to write something like  
> this would be much appreciated.
> 
> Thanks.

This is complicated enough that I'd recommend buying a package that  
already works rather than building something. This isn't a particularly  
good beginner's project, and I'm not sure how you'd test it. And I have  
concerns about anybody going off and asking for my user ID and password.  
\*Real\* IT solutions just don't work that way.

---

<div class="post-metadata">

**Author:** ![Mike\_Rood](https://avatars.discourse-cdn.com/v4/letter/m/8e8cbc/32.png) [@Mike\_Rood](https://rubytalk.org/u/Mike_Rood)\
**Post date:** [30 August 2007 22:20 UTC](https://rubytalk.org/t/collecting-remote-system-information/40262/3 "2007-08-30T22:20:13Z")

</div>

If your program is running on a Windows computer, it's actually pretty  
easy to get reams of information from remote Windows computers.  
Windows Management Instrumentation (WMUI), part of Microsoft's  
implementation of the Web-based Enterprise Management (WBEM) standard,  
is built in to all Windows versions since Windows 2000, I think, and  
it can be added onto Windows 98. To query remote computers, you have  
to be a member of a security group that includes local administrator  
authority for the remote computers, e.g. domain admins. If you're not  
a member of such a group, you probably shouldn't be querying those  
computers. Using WMI, you can collect far more information than is  
practical to display to the terminal.

To get an idea of the information that's available, download  
Microsoft's Scriptomatic 2.0 at  
[http://www.microsoft.com/downloads/details.aspx?FamilyID=09dfc342-648b-4119-b7eb-783b0f7d1178&DisplayLang=en](http://www.microsoft.com/downloads/details.aspx?FamilyID=09dfc342-648b-4119-b7eb-783b0f7d1178&DisplayLang=en)  
and run some of the built-in queries on your own computer.  
Scriptomatic generate scripts in VB Script and Perl, among others, and  
it's not hard to translate them to ruby once you know how. In ruby,  
the basic WMI calls are executed with win320le. Take a look at the  
example programs [http://snippets.dzone.com/posts/show/4280](http://snippets.dzone.com/posts/show/4280) and  
[http://rubyonwindows.blogspot.com/2007/06/using-ruby-wmi-to-detect-usb-drive.html\](http://rubyonwindows.blogspot.com/2007/06/using-ruby-wmi-to-detect-usb-drive.html%5C).  
[Ruby on Windows: From VB to Ruby - Creating Objects via COM](http://rubyonwindows.blogspot.com/2007/02/from-vb-to-ruby-creating-objects-via.html)  
explains some of the basic translations from vbscript to win32ole in  
ruby. There's a lot of other helpful information at [http://rubyonwindows.blogspot.com](http://rubyonwindows.blogspot.com)  
showing you how to interface to other Microsoft products. The pickaxe  
book provides some good examples for manipulating Excel with  
win32ole. The Microsoft Scripting Guys did some great webcasts on WMI  
scripting on the Microsoft Technet site.

I think that should be enough to get you started. Good luck.

Mike

> **···**
>
> On Aug 30, 1:04 am, "Chris Henderson" \<henders...@gmail.com\> wrote:
> 
> > I am relatively new to coding and to ruby.
> > 
> > I have seen programs like IBM Director installs an agent on a client  
> > machine and gather all kinds of information remotely; eg. amount of  
> > ram, processor type and speed, machine type and serial number, OS  
> > running, netbios name etc.
> > 
> > Would it be possible to write something like this with ruby. Ideally,  
> > the ruby program will run on Fedora or OpenBSD and the clients are  
> > Windows XP machines. Once the program is being run it will ask for the  
> > Windows box's user name and password to gather all the information and  
> > will dump it in STDOUT.
> > 
> > Any hints or tips on where to start looking to write something like  
> > this would be much appreciated.
> > 
> > Thanks.

---

<div class="post-metadata">

**Author:** ![Kyle\_Schmitt](https://avatars.discourse-cdn.com/v4/letter/k/9e8a1a/32.png) [@Kyle\_Schmitt](https://rubytalk.org/u/Kyle_Schmitt)\
**Post date:** [30 August 2007 15:03 UTC](https://rubytalk.org/t/collecting-remote-system-information/40262/4 "2007-08-30T15:03:22Z")

</div>

I've worked on some projects before for this sort of thing, and Ed is right.

It's not pretty.

The only way to do it without really mucking about on each system is  
to get the data in the system-specific format, then munge it together  
into whatever global format you design.

This means writing system specific code for ... well each system to test.

There's a MS command line app some where on the MSDN site (complete  
with sample code) that can be used to gather lots of info for ms OSes  
(no I don't remember the name of the app, sorry), and then, depending  
on the unicies you're dealing with, data will be exposed by different  
system calls or virtual file systems.

--Kyle

---

<div class="post-metadata">

**Author:** ![Mohit\_Sindhwani1](https://avatars.discourse-cdn.com/v4/letter/m/dbc845/32.png) [@Mohit\_Sindhwani1](https://rubytalk.org/u/Mohit_Sindhwani1)\
**Post date:** [30 August 2007 15:36 UTC](https://rubytalk.org/t/collecting-remote-system-information/40262/5 "2007-08-30T15:36:38Z")

</div>

Kyle Schmitt wrote:

> I've worked on some projects before for this sort of thing, and Ed is right.
> 
> It's not pretty.
> 
> The only way to do it without really mucking about on each system is  
> to get the data in the system-specific format, then munge it together  
> into whatever global format you design.
> 
> This means writing system specific code for ... well each system to test.
> 
> There's a MS command line app some where on the MSDN site (complete  
> with sample code) that can be used to gather lots of info for ms OSes  
> (no I don't remember the name of the app, sorry), and then, depending  
> on the unicies you're dealing with, data will be exposed by different  
> system calls or virtual file systems.
> 
> --Kyle

There are a couple of packages on RubyForge that are cross-platform Ruby libraries for returning some of the basic information about the system. The URL is: [http://rubyforge.org/projects/sysutils](http://rubyforge.org/projects/sysutils)

I just downloaded some of these for adding more information to one of the regular scripts that I run for gathering statistics about the running environment of some largely unattended scripts and to alert me if the status changes (mostly, I was interested in finding free disk space).

I'm not sure if these packages will give you something that helps.

Cheers,  
Mohit.  
8/30/2007 | 11:36 PM.

---

<div class="post-metadata">

**Author:** ![Mike\_B](https://avatars.discourse-cdn.com/v4/letter/m/977dab/32.png) [@Mike\_B](https://rubytalk.org/u/Mike_B)\
**Post date:** [30 August 2007 20:10 UTC](https://rubytalk.org/t/collecting-remote-system-information/40262/6 "2007-08-30T20:10:08Z")

</div>

Also, what about the possibility of using something like  
Puppet(because it's ruby),CFengine or even Capistrano (also ruby)?

Mike B.

> **···**
>
> On Aug 30, 7:36 am, Mohit Sindhwani \<mo\_m...@onghu.com\> wrote:
> 
> > Kyle Schmitt wrote:  
> > \> I've worked on some projects before for this sort of thing, and Ed is right.
> > 
> > \> It's not pretty.
> > 
> > \> The only way to do it without really mucking about on each system is  
> > \> to get the data in the system-specific format, then munge it together  
> > \> into whatever global format you design.
> > 
> > \> This means writing system specific code for ... well each system to test.
> > 
> > \> There's a MS command line app some where on the MSDN site (complete  
> > \> with sample code) that can be used to gather lots of info for ms OSes  
> > \> (no I don't remember the name of the app, sorry), and then, depending  
> > \> on the unicies you're dealing with, data will be exposed by different  
> > \> system calls or virtual file systems.
> > 
> > \> --Kyle
> > 
> > There are a couple of packages on RubyForge that are cross-platform Ruby  
> > libraries for returning some of the basic information about the  
> > system. The URL is:[http://rubyforge.org/projects/sysutils](http://rubyforge.org/projects/sysutils)
> > 
> > I just downloaded some of these for adding more information to one of  
> > the regular scripts that I run for gathering statistics about the  
> > running environment of some largely unattended scripts and to alert me  
> > if the status changes (mostly, I was interested in finding free disk space).
> > 
> > I'm not sure if these packages will give you something that helps.
> > 
> > Cheers,  
> > Mohit.  
> > 8/30/2007 | 11:36 PM.
