title: get file version of .dll in powershell from remote computers
body: <p>I am trying to get the file version of a dll remotely using Powershell on several servers and have write the server name, dll version, and dll file location to a csv or html report. The catch is some of the servers are Win 2003 and  Win 2008. So the file may reside in for example C:\Program Files\WinZip\WZCAB.DLL or C:\Program Files (x86)\WinZip\WZCAB.DLL. The script would check one location and if it did not exist it would check the other and then write it out. Can anyone help me out?</p>
  
  <p>Just a few things - This script will be used to access 200+ servers or VM's both 2003 and 2008. On 2003 it needs Powershell 2.0 and 2008 it will be timely to enable remoting. I was thinking maybe I need to utilize WMI. I have two other scripts that utilize WMI to get patches and reboot times. I did though try Ravikanth script (thank you again) and got the following error when passing a txt file of servers - One or more computer names is not valid. If you are trying to pass a Uri, use the -ConnectionUri parameter or pass Uri objects instead of strings. Again since I will not be enabling remoting on each server, is there another way of doing this? I modified Ravikanth script (below) and tried it locally, works greats. When I try it remotely, it does not. Any thoughts?</p>
  
  <pre><code>$servers = "D:\scripts\winzip\servers.txt" 
  $x86Path = 'C:\Program Files (x86)\WinZip\WZCAB.DLL'
  $x64Path = 'C:\Program Files\WinZip\WZCAB.DLL'
  
      foreach ($computername in $servers){
          if (Test-Path $x86Path) {
              (Get-Item $x86Path | Select -ExpandProperty VersionInfo).FileVersion
          } elseif (Test-Path $x64Path) {
              (Get-Item $x64Path | Select -ExpandProperty VersionInfo).FileVersion           
          }
      }
  </code></pre>