Is it possible to search multiple folders to target versioninfo off a .dll

Welcome Forums General PowerShell Q&A Is it possible to search multiple folders to target versioninfo off a .dll

Viewing 2 reply threads
  • Author
    Posts
    • #213006
      Participant
      Topics: 3
      Replies: 5
      Points: 41
      Rank: Member

      I know if I run this command:

      $DLLPath = "C:\Windows\winsxs\x86_microsoft.vc80.atl_1fc8b3b9a1e18e3b_8.0.50727.762_none_11ecb0ab9b2caf3c\ATL80.dll"
      (Get-Item $DLLPath).VersionInfo.FileVersion

      It will tell me the version off:  ATL80.dll

      Is it possible to do a search in the C:Windows\winsxs and find any files with a certain version?  For example, if ATL80.DLL has version 12345, I want to find any other .dlls in the winxsx that also have the same version.

      I thought:  select-string would do it but I am not getting the syntax right or there is another way.

       

    • #213036
      Participant
      Topics: 4
      Replies: 2247
      Points: 5,484
      Helping Hand
      Rank: Community MVP

      In this special case I’d recommend to use the product version instead of the file version. As the file version used to have additional “info” in it you don’t need usually. (something like “(WinBuild.160101.0800)” or “(WinRelRS6.050727-9100)”)
      So you’d end up with something like this:

      Get-ChildItem -Path C:\Windows\WinSxS -Filter *.dll -Recurse -Force -ErrorAction SilentlyContinue |
          Where-Object {$_.VersionInfo.ProductVersion -eq [Version]'1.2.345.6789'} |
              Select-Object -Property @{Name='ProductVersion'; Expression = {$_.VersionInfo.ProductVersion}},FullName

      Of course you need to adjust the version you’re looking for. 😉

    • #213435
      Participant
      Topics: 3
      Replies: 5
      Points: 41
      Rank: Member

      In this special case I’d recommend to use the product version instead of the file version. As the file version used to have additional “info” in it you don’t need usually. (something like “(WinBuild.160101.0800)” or “(WinRelRS6.050727-9100)”)

      So you’d end up with something like this:

      PowerShell
      3 lines

      <textarea class=”ace_text-input” style=”left: 44px; top: 0px; width: 6.6px; height: 18px; opacity: 0;” spellcheck=”false” wrap=”off”></textarea>

      1
      2
      3
      Get-ChildItem Path C:\Windows\WinSxS Filter *.dll Recurse Force ErrorAction SilentlyContinue |
      Where-Object {$_.VersionInfo.ProductVersion -eq [Version]‘1.2.345.6789’} |
      Select-Object Property @{Name=‘ProductVersion’; Expression = {$_.VersionInfo.ProductVersion}},FullName
      XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

      Of course you need to adjust the version you’re looking for. 😉

      Thank you

Viewing 2 reply threads
  • You must be logged in to reply to this topic.