View installed programs on remote machine?

I was wondering if there is an easy and lightweight method to viewing what programs are installed on a remote machine? I am tempted to use Spiceworks but I would like something more lightweight like a script. I have been playing around with WMIC a little and can get a list of programs for my computer but I don't know if I can do the same with it for a remote computer. Any ideas?

Edit: Sorry that I forgot the OS, we are using mostly Windows XP and 7, I use Windows 7. I am looking for something to be run in the background without a user that is currently using the computer knowing. I would like to be able to do it during the workday while people are working and do so without interrupting them. I do appreciate the Linux answers since I am trying to learn more about Linux and plan to personally change over sometime.


Solution 1:

You can use one of the Sysinternals tools PSinfo:

http://technet.microsoft.com/en-us/sysinternals/bb897550

PsInfo v1.77 - Local and remote system information viewer Copyright (C) 2001-2009 Mark Russinovich Sysinternals - www.sysinternals.com

PsInfo returns information about a local or remote Windows NT/2000/XP system.

Usage: psinfo [-h] [-s] [-d] [-c [-t delimiter]] [filter] [\computer[,computer[,..]]|@file [-u Username [-p Password]]]

 -u        Specifies optional user name for login to
           remote computer.
 -p        Specifies password for user name.
 -h        Show installed hotfixes.
 -s        Show installed software.
 -d        Show disk volume information.
 -c        Print in CSV format
 -t        The default delimiter for the -c option is a comma,
           but can be overriden with the specified character. Use
           "\t" to specify tab.
 filter    Psinfo will only show data for the field matching the

filter. e.g. "psinfo service" lists only the service pack field. computer Direct PsInfo to perform the command on the remote computer or computers specified. If you omit the computer name PsInfo runs the command on the local system, and if you specify a wildcard (\*), PsInfo runs the command on all computers in the current domain. @file PsInfo will run against the computers listed in the file specified.

Issuing

PSinfo -s \\computername

will tell you what is installed on a remote computer.

Solution 2:

On an rpm-based Linux distribution, you could run the following:

ssh <user-who-can-run-rpm>@<remote.host> 'rpm -qa | sort'

For a deb-based distribution, pass this to the ssh command:

'dpkg-query -l | sort'

For Gentoo (per a supplied comment from Monksy):

'qpkg -I | sort'

For Solaris:

'pkginfo -i | sort'

And on AIX:

'lslpp -a all | sort'

Solution 3:

WMIC can be used remotely, by default, with an account that is part of Administrators group. You can delegate read-only WMI access to a normal user.

SNMP can be used too - you just need to configure a read-only community. You need to browse hrSWInstalled table: snamwalk -c public -v2c server_IP hrSWInstalled

See also: http://technet.microsoft.com/en-us/library/bb742610.aspx