Avatar of ITguy565
ITguy565
Flag for United States of America

asked on 

Retrieve Version Information from Exe File utilizing WMI

Experts,

I am Attempting to pull Version Information from a EXE file on my Hard Drive and the "ProductVersion" doesn't match the "FileVesion"

An Example of this would be the following command :

$test = get-childitem *fileName*.exe
$test.versioninfo.fileversion = "1.0.0.0"
$test.versioninfo.productversion = "2.3.4.5"

Open in new window

I need to pull the Productversion using nothing but a WMI query..

So far I have found the class cim_datafile which will allow me to pull using the following query

$test2 = get-wmiobject -class cim_datafile -filter "Drive='C:' AND Extension='exe' AND Path Like '%\\programdata\\testr\\%'"|? {$_.name -like "*filename*"}
$test2.version = 1.0.0.0

Open in new window


This means that it is querying the "VersionInfo.FileVersion" Property above


Here is my question is there a way to pull the "ProductVersion" property using nothing but WMI??

I am trying to utilize one of my other toolsets that can only use WMI

Powershell* WMICScripting Languages

Avatar of undefined
Last Comment
Michael B. Smith

8/22/2022 - Mon