Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Help! WMI and Winows Media Player

65 views
Skip to first unread message

sjw2k3

unread,
Dec 1, 2005, 9:04:02 AM12/1/05
to
Hi
I'm putting together a script to gather info on certain software packages
such as version number etc... installed on multiple desktops.
My problem is trying to extract the version information from Windows Media
Player.
I can't get any results from using the Win32_Product class or from querying
the uninstall kep HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\

I could query the executable directly but would prefer not to as some of the
versions are very old so some will be Mplayer.exe, Mplayer2.exe, WMPlayer.exe
etc...

Does anyone know of a class I can use to query info about media player?

Thanks
Steve

mr_unreliable

unread,
Dec 1, 2005, 11:24:22 AM12/1/05
to
hi Steve,

There is no neat-and-clean way to get this (that I know of).

Here is one suggestion.

As long as the windows media player is installed in the
customary place, (Program Files\Windows Media Player),
then you can "walk" the list of files in there using fso,
to pick out the possibilities (you mentioned: Mplayer.exe,
Mplayer2.exe, WMPlayer.exe, etc). Note that there could
be more than one, as subsequent version may have been
installed without un-installing the previous version.

Next you determine the version of each of the possibilities
(the "sticky-wicket" part).

The most "pure script" approach for getting the version
would be to use wmi's win32_FileSpecification class, which
can get you the version property of a file (as a string).
See here:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/win32_filespecification.asp

There is a demo script, showing how to use
win32_FileSpecification here (search down to the middle
of the page):

http://www.activexperts.com/activmonitor/windowsmanagement/wmi/samples/apps/#Win32_FileSpecification.htm

The other approach is to use the system api's (because
wmi does not always work as advertised). Using api's in
script is problematical, especially in this case because
typedefs are involved. So you best bet is to write an actX
"wrapper" for the api call.

Just in case you are considering using api's, sample code
may be found here:

http://www.vb-helper.com/howto_file_version_info.html

After you have determined the latest version of wmplayer(s),
one may fairly assume that is the one the user is using.

cheers, jw
____________________________________________________________

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)

mr_unreliable

unread,
Dec 1, 2005, 12:07:01 PM12/1/05
to
uh-oh. I was looking for "version info" as a member of the
"file object" class of fso.

However, you can get it using "fso.GetFileVersion(path)".

So, no excursions into wmi, or api calls are necessary.

Plain ole fso will do it.

cheers, jw

sjw2k3

unread,
Dec 1, 2005, 12:11:03 PM12/1/05
to
Thanks for a very detailed reply jw.

I better get writing that script hadn't I :)

Thanks again

Steve

0 new messages