<# .SYNOPSIS Gets the version number for an assembly .DESCRIPTION .NOTES File Name : Get-AssemblyVersion.ps1 Author : Thomas Lee - tfl@psp.co.uk Requires : PowerShell V4 .LINK http://pshscripts.blogspot.co.uk/2008/07/get-assemblyversionps1.html .EXAMPLE PSH [C:\foo]: .\Get-AssemblyVersion.ps1' Assembly: System.Speech has version number of: 4.0.0.0 #> # Start of script # Define the assembly we want to load - a random reference assembly from SDK 3.0 $Pshfile = "C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\v3.0\system.speech.dll" # Now load the assembly $Myasm = [System.Reflection.Assembly]::Loadfile($Pshfile) # Get name, version and display the results $Aname = $Myasm.GetName() $Aver = $Aname.version # Display results "Assembly: {0} has version number of: {1}" -f $Aname.name, $aver # End of script
This blog contains PowerShell scripts, more PowerShell scripts and still more PowerShell scripts. Occasionally you may see some organisational posts.
Tuesday 18 November 2008
Get-AssemblyVersion.ps1
Labels:
loadfile,
powershell,
system.reflection.assembly
Subscribe to:
Post Comments (Atom)
1 comment:
You should post these on PoshCode.org :)
Post a Comment