none
PowerShell can not get the correct file version RRS feed

  • Question

  • Hi guys,

    I am now doing sth. converting vbscript to poershell. in vbscript using  strFileVersion = objFSO.GetFileVersion() method can get the correct version of c:\windows\system32\httpapi.dll. That is 6.1.7601.17514.  

    I convert this method to powershell, I got the misleading version. That is 6.1.7600.16385. PowerShell script is as follows.

    [System.Diagnostics.FileVersionInfo]::GetVersionInfo("c:\windows\system32\httpapi.dll").FileVersion

    Does anyone know why? Thanks!

    Tuesday, February 21, 2012 3:51 AM

Answers

  • You should get the ProductPrivatePart to get the correct version...

    (gci httpapi.dll).versioninfo.productprivatepart

    If you want the complete output...

    $a = (gci httpapi.dll).versioninfo
    [string]$a.productmajorpart + "." + [string]$a.productminorpart + "." + [string]$a.productprivatepart


    Thanks, Wilson Souza - MSFT This posting is provided "AS IS" with no warranties, and confers no rights

    Tuesday, February 21, 2012 5:03 AM
    Moderator

All replies