Thursday, 10 November 2011

Show-FileVersionComments.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     This script shows the comments of a file version object 
  4. .DESCRIPTION 
  5.     This script is a re-implementation of an MSDN Sample script 
  6.     that uses System.Diagnostics.FileVersionInfo to get 
  7.     the company name (if it exists). 
  8. .NOTES 
  9.     File Name  : Show-FileVersionComments.ps1 
  10.     Author     : Thomas Lee - tfl@psp.co.uk 
  11.     Requires   : PowerShell Version 2.0 
  12. .LINK 
  13.     This script posted to: 
  14.         http://www.pshscripts.blogspot.com 
  15.     MSDN sample posted to: 
  16.          http://msdn.microsoft.com/en-us/library/system.diagnostics.fileversioninfo.comments.aspx    
  17. .EXAMPLE 
  18.     Psh> .\Show-FileVersionComments.ps1 
  19.     Comments : Microsoft Corporation 
  20. #> 
  21. # Set filename 
  22. $File = [System.Environment]::SystemDirectory + "\Notepad.exe" 
  23.  
  24. #Get Version information for this file 
  25. $myFileVersionInfo = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($File
  26.  
  27. # Print the Comments field 
  28. "Commments : " + $myFileVersionInfo.CompanyName 

1 comment:

Cindy Dy said...

Thanks for putting an effort to publish this information and for sharing this with us.

Cathy
www.gofastek.com