Thursday, 10 November 2011

Show-FileVersionCompanyName

  1. <# 
  2. .SYNOPSIS 
  3.     This script shows the company name 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-FileVersionCompanyName.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.companyname.aspx    
  17. .EXAMPLE 
  18.     Psh> .\Show-FileVersionCompanyName.ps1 
  19.     Company name: 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 Company name 
  28. "Company name: " + $myFileVersionInfo.CompanyName 

No comments: