Collecting remote system information

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.

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Chris H. wrote:

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.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFG1svp8fKMegVjSM8RAl8YAKDCpOTJc4MwLcuHpb5weZAy78BKRQCgnaA+
v09+cu4cFJd4+goR+wCQDK0=
=uLer
-----END PGP SIGNATURE-----

Kyle S. wrote:

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

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.

On Aug 30, 7:36 am, Mohit S. [email protected] wrote:

system. The URL is:http://rubyforge.org/projects/sysutils
8/30/2007 | 11:36 PM.
Also, what about the possibility of using something like
Puppet(because it’s ruby),CFengine or even Capistrano (also ruby)?

Mike B.

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

On Aug 30, 1:04 am, “Chris H.” [email protected] wrote:

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.

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
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 and
http://rubyonwindows.blogspot.com/2007/06/using-ruby-wmi-to-detect-usb-drive.html.
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
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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs