Powershell get-item VersionInfo.ProductVersion incorrect / different from WMI

I am trying to understand why Powershell will return a different version number for the DLL file than what the file properties page from Windows Explorer and the WMI request show. (I apologize in advance if this incorrectly qualifies as a coding issue.)

Scenario:

Running the following powershell command:

(get-item C:\windows\system32\rdpcorekmts.dll).VersionInfo.ProductVersion 

This returns the following:

6.1.7600.16385

However, this version number is incorrect. When you look at the version information from Windows Explorer, you see the following version (sorry, I tried to publish a small screenshot, but I don't have enough reputation, I'm new here):

6.1.7601.17767

In addition, the WMIC query shows the same results as Windows Explorer:

 WMIC path CIM_DataFile WHERE (name="c:\\windows\\system32\\rdpcorekmts.dll") get Version 

WMIC result:

Version

6.1.7601.17767

I really don't understand why they will be different. I really would like to return this value using Powershell, but now I'm not sure if I just missed something, or if I came across some strange error, but the version mismatch between the two methods is confusing. As a note, I used the method variations to return it to Powershell (e.g. Get-ItemChild and Get-ItemProperty), and I get the same incorrect version result.

Any ideas on why?

+4
source share
1 answer

The problem is that you are using the ProductVersion property, which seems to be hardcoded somewhere, IE and WMI just create a version of the product:

 ProductMajorPart : 6 ProductMinorPart : 1 ProductBuildPart : 7601 ProductPrivatePart : 17767 

Same for FileVersion with: FileMajorPart, FileMinorPart, FileBuildPart, FilePrivatePart

Just try:

 (get-item C:\windows\system32\rdpcorekmts.dll).VersionInfo | fl * 

You can check:

 (get-item C:\windows\system32\rdpcorekmts.dll).VersionInfo | % {("{0}.{1}.{2}.{3}" -f $_.ProductMajorPart,$_.ProductMinorPart,$_.ProductBuildPart,$_.ProductPrivatePart)} 

From CMD.EXE you can try:

 C:\>powershell -command "&{(get-item C:\windows\system32\rdpcorekmts.dll).VersionInfo | % {write-host ('{0}.{1}.{2}.{3}' -f $_.ProductMajorPart,$_.ProductMinorPart,$_.ProductBuildPart,$_.ProductPrivatePart)}}" 
+8
source

All Articles