Monday 4 May 2009

Get-LegalInfo.ps1

  1. <# 
  2. .SYNOPSIS 
  3.     Gets LegalCopyright and Legal Trademarks from a file, if they exist. 
  4. .DESCRIPTION 
  5.     This script uses System.Diagnostic.FileVersionInfo to get the version information 
  6.     of a file. in this sample, I use notepad.exe, as shipped with Windows. 
  7.    
  8.     If you look at the output, you see LegalTrademarks are empty - this is the result I get on my 
  9.     main workstation.  
  10. .NOTES 
  11.     File Name  : Get-LegalInfo.ps1 
  12.     Author     : Thomas Lee - tfl@psp.co.uk 
  13.     Requires   : PowerShell V2 CTP3 
  14. .LINK 
  15.     http://www.pshscripts.blogspot.com 
  16. .EXAMPLE 
  17.     PSH [C:\foo]: .\Get-LegalInfo.ps1 
  18.     LegalCopyright  :  c Microsoft Corporation. All rights reserved. 
  19.     Legal Trademarks: 
  20. #> 
  21. ## 
  22. # start of script 
  23. ## 
  24.   
  25. # Get the file version for the notepad. 
  26. $MyFileVersionInfo = [System.Diagnostics.FileVersionInfo]::GetVersionInfo("C:\windows\Notepad.exe"
  27.   
  28. # Now output legal Information 
  29. "LegalCopyright  :  {0}" -f $MyFileVersionInfo.LegalCopyright 
  30. "Legal Trademarks:  {0}" -f $myFileVersionInfo.LegalTrademarks 
  31. # End of Script 

No comments: