How to find a Program Version on List of Computers Using wmic and psexec

Printer-friendly versionPDF version
How to find a Program Version on List of Computers Using wmic and psexec

Using wmic, you can easily get a list of most of the applications installed on a computer:

wmic Product get Name

How to find a Program Version on List of Computers Using wmic and psexec1

To list the name & version of a program that you know part of the name to, run the following:

wmic product where "Name like '%Java%'" get Name, Version

To list the name & version of a program that you know the full name of, run the following:

wmic product where "Name='Java 7 Update 60'" get Name, Version

How to find a Program Version on List of Computers Using wmic and psexec 2

 

 

Now that you know how to get a program name & version using the command line, now you just need to learn how to run the command on a group of computers. There are two ways to do this, both involving psexec, a utility from the sysinternals suite.

Method 1:

psexec has a built in method for running a command on every computer in the domain. To do this, you need to have cmd.exe running as a user account that has permissions on all the computers you will be running remote commands on (for example, a domain administrator). The format is "psexec \\* command_you_want_to_run". The \\* section will enumerate every computer in the domain, and run the command on each of them. This is the easiest method:

psexec \\* wmic product where "Name like '%Java%'" get Name, Version

How to find a Program Version on List of Computers Using wmic and psexec 3

Method 2:

You may find that \\* includes computers you don't want, or computers that are no longer on the network. You can also supply a list of computers to psexec, with each computer name on a new line. There are several ways to get a list. You can manually create one, export one from active directory, or use a tool like AD Info to create a custom list, with only the types of devices you want in it. Once you have the list saved, supply the name of it to psexec like this:

psexec.exe @C:\pclist.txt wmic product where "Name like '%Java%'" get Name, Version

How to find a Program Version on List of Computers Using wmic and psexec 4

Now you have a list that you can simply copy out of the command prompt window. As you can see, this process can be useful in many scenarios. wmic is a very powerful utility, and you can use it, and this process, for much more than getting application names & versions. Check out this article from Microsoft on some of the other things you can query with wmic:

http://blogs.technet.com/b/askperf/archive/2012/02/17/useful-wmic-queries.aspx

Post new comment