PowerShell: Get File Version Info


$files = get-childitem $args -recurse -include *.dll,*.exe
 if($files -eq $null)
  {
   Write-Host "No Exe or dll files present in the folder";
  }
 else
  {
   foreach ($i in $files)
    {
     $ver = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($i).FileVersion
     if($ver -eq $null)
      {
       $i.FullName | Out-File NoVersion.txt -append
       }
    else
     {
       "{0}`t{1}"-f $i.FullName, [System.Diagnostics.FileVersionInfo]::GetVersionInfo($i).FileVersion | out-file Version.xls -append
     }
   }
  }
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s