7

I'd like to find the manufacturer, model and serial number of various Windows (XP, Vista, 2003, 2008) and Linux (Ubuntu, Debian, Fedora) machines via a software solution.

Currently our hardware inventory is out of date, so I'd like a quick rapid way to get this information via a software solution (so I don't need to approach every single computer to read the sticker).

I'd like to script this so ideally it wouldn't require any 3rd party applications, if it does ideally it'd be stand alone so it's easily portable.

Any idea to how this could be done best? If there's a pre-built (free) solution ideally I'd like it reporting to either raw text or a MySQL database. Ideally a small stand alone tool, I don't want to be installing stuff on each PC. As mentioned above though, I'm perfectly happy to script this using prebuilt OS tools. I know this is possible as I've seen other apps reporting this information (although in massive bulk packages with other stuff I don't need e.g. Spiceworks).

HopelessN00b
  • 53,385
  • 32
  • 133
  • 208
Adam Gibbins
  • 7,147
  • 2
  • 28
  • 42

6 Answers6

6

For Linux then I would say look at dmidecode which is quite often pre-installed or can be easily installed from the distribution's repository.

This will generate a plain text report of all the hardware on the system including serial numbers.

Nathan
  • 1,177
  • 6
  • 9
  • 1
    and WMI on Windows and you are set to script it... – torial May 05 '09 at 21:09
  • dmidecode seems to report stuff similar to: Base Board Information Manufacturer: LENOVO Product Name: LENOVO Version: To be filled by O.E.M. Serial Number: To be filled by O.E.M. Asset Tag: To Be Filled By O.E.M. On the majority of machines which is somewhat annoying. Although if I run a tool such as Spiceworks on Windows machine it reports the information fine. – Adam Gibbins May 05 '09 at 21:19
  • try biosdecode too. – pjz May 05 '09 at 21:26
5

For Windows, you could use a quick powershell script to wrap up WMI, something like this:

function Get-Inventory([string] $computer = '.')
{
    $data = ""|select name, vendor, model, serial
    $bios = get-wmiobject 'win32_BIOS' -computername $computer
    $comp = get-wmiobject 'win32_computersystem' -computername $computer
    $data.name = $comp.Name
    $data.vendor = $comp.manufacturer
    $data.model = $comp.Model
    $data.serial = $bios.SerialNumber
    return $data
}

If you feed that a text file listing all your computers, like this:

get-content 'mycomputers.txt' | foreach-object{Get-Inventory}

you will end up with a nice table of computers and hardware details. If you need to archive the data, use the export-csv cmdlet to dump the output straight to a file.

user2278
  • 873
  • 5
  • 9
3

There is an excellent (albeit commercial) solution that does exactly this (the raw text would be csv format I believe), called ISI Snapshot: http://www.isiisi.com/snapshot.htm

It will get all that info and very quickly.

I mention it because you said "if there's a pre-build solution"....

Edit: Also check /proc/cpuinfo and the lsattr -El sys0

torial
  • 316
  • 3
  • 7
1

Take a look at SpiceWorks. SpiceWorks uses WMI and SSH to collect this information from Windows, Mac and Linux machines. Not a script but a complete solution including a local database for what you are looking for here. Worth taking a look at least.

0

I think you may use WMI to get Windows information, you can get information remotely if you have administrator privileges.

Eugenio Miró
  • 219
  • 4
  • 11
0

For hard drives on Linux you should be able to use a tool like smartctl included in the smartmontools library to get the information you want, for example this is what my drive currently reports:

=== START OF INFORMATION SECTION ===
Model Family:     Western Digital Caviar SE Serial ATA family
Device Model:     WDC WD800JD-22LSA0
Serial Number:    WD-XXXXXXXXXXXX (obscured by me)
Firmware Version: 06.01D06
User Capacity:    80,026,361,856 bytes

From that information you can fairly easily script it to send it back using netcat to a remote server that adds it into a MySQL database.

X-Istence
  • 752
  • 1
  • 8
  • 18