# Get-AssemblyVersion.ps1
# Sample using PowerShell
# Thomas Lee - tfl@psp.co.uk
# 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
This script produces the following output:
PS C:\foo> .\get-assemblyversion.ps1
Assembly: System.Speech has version number of: 3.0.0.0